#Does someone know how to pass string array in postgreSQL in Exposed(kotlin framework)
30 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @foggy heron! Please use
/closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
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
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
CREATE TABLE IF NOT EXISTS public.profile
(
login character varying(25) COLLATE pg_catalog."default" NOT NULL,
username character varying(25) COLLATE pg_catalog."default" NOT NULL,
description character varying(300) COLLATE pg_catalog."default",
images character varying(100)[] COLLATE pg_catalog."default",
tags character varying(100)[] COLLATE pg_catalog."default",
CONSTRAINT profile_pkey PRIMARY KEY (login)
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.profile
OWNER to postgres;
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 tags
arent 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.