#Does someone know how to pass string array in postgreSQL in Exposed(kotlin framework)

30 messages · Page 1 of 1 (latest)

foggy heron
#

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?

ancient talonBOT
#

This post has been reserved for your question.

Hey @foggy heron! Please use /close or the Close 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.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

cobalt elbow
#

What does the SQL query look like?

#

Are you using IN?

#
GitHub

Do you have any plan to support array column support?

foggy heron
cobalt elbow
#

Can you show the queries you were doing?

foggy heron
foggy heron
cobalt elbow
#

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

foggy heron
#

well i'm trying to send in database array of URL of images

foggy heron
# cobalt elbow ig maybe the table could help as well

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;
cobalt elbow
#

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

foggy heron
#

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

cobalt elbow
#

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

foggy heron
cobalt elbow
#

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

foggy heron
#

oh well thank you, that will help me so much

ancient talonBOT