From: | Alke <alke(at)iol(dot)it> |
---|---|
To: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Array-fields and many-to-many relations |
Date: | 1999-08-20 21:28:05 |
Message-ID: | 37BDC865.9BB15F3E@iol.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-sql |
Hy all!
I want to make a many-to-many relation on my db, and I would like to use
an array-field of the external keys...
This is what I whoul like to create:
CREATE TABLE Groups(
IDGroup SERIAL, -- Primary key
...
);
CREATE TABLE Customers(
IDGroups INT4[], -- Multiple foreign keys
...
);
SELECT Customers.* FROM Customers WHERE IDSearchedGroup IN
Customers.IDGroups;
IDSearchedGruop is obviously a parameter.
Well, this query doesn't work because in the SELECT ... the operator
"IN" can work only on subselect, not on array... how can I check if an
element belongs to an array or not? Performance are not critical,
because I have few groups...
Yes, I know that the common way to make many-to-many relations is adding
a support table... but I don't like the conventional solution to this
problem... any ideas???
Paolo
From | Date | Subject | |
---|---|---|---|
Next Message | Dmitri G. Chtchekine | 1999-08-20 23:39:01 | pq_recvbuf: unexpected EOF on client connection |
Previous Message | Alke | 1999-08-20 20:51:07 | OID and PL/pgSQL trigger :-( |
From | Date | Subject | |
---|---|---|---|
Next Message | Clayton Cottingham | 1999-08-20 23:07:24 | is this possible, maybe a todo ? function related |
Previous Message | Alke | 1999-08-20 20:51:07 | OID and PL/pgSQL trigger :-( |