Does someone know how to pass string array in postgreSQL in Exposed(kotlin framework)
There's jetbrains kotlin framework named Exposed and it's for DB. I'm trying to pass array to postgresql but there's no functions to do it, maybe someone knows how to do it?
16 Replies
⌛
This post has been reserved for your question.
Hey @S.R.M! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
What does the SQL query look like?
Are you using
IN
?https://stackoverflow.com/a/62818056/10871900 and https://github.com/JetBrains/Exposed/issues/150 could be relevant in that regard
Stack Overflow
How to add array Column type in Jetbrains Exposed
I am trying to add a column of type array to my Postgres table using exposed.The goal is to have a statement like:
UPDATE posts
SET like_user_id = like_user_id || $1, likes = likes +...
GitHub
Array column type support · Issue #150 · JetBrains/Exposed
Do you have any plan to support array column support?
well Idk, i was just using functions from exposed, im really green in sql and i'm creating tables with pgadmin4
Can you show the queries you were doing?
i already saw the second link i found some custom functions but i'm not sure if they are working so i'm testing it
you mean show sql table?
Well, what exactly are you trying to do?
ig maybe the table could help as well
passing arrays or similar isn't really something SQL DBs are good at
well i'm trying to send in database array of URL of images
here auto generate sql code
yeah so normally you wouldn't have arrays in the DB
instead, you would have a different table
e.g. a table
profile_images
with a column for the image name and profile ID (foreign key)
similar for tagsarent arrays made for this?
like i thought for these things arrays are made but if arrays is bad practice for DB then i'll do what you said
arrays don't work the same way in all database systems
some databases might even not support arrays at all
I don't really know about postgres but in my experience, arrays are somewhat difficult
With SQL databases, you typically want your schema to be in a normal form
hmmmm, okay then i'll do it instead of my decision
which means only one thing per column (1. NF), stuff should only be dependent on the full primary key (2. NF) and stuff shouldn't transitively depend on content from non-primary keys (3. NF)
these things can help when it comes to avoiding redundancy/inconsistencies
oh well thank you, that will help me so much
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Post Closed
This post has been closed by <@399891918428831754>.