Received: from mta4.iol.it (mta4.iol.it [195.210.91.154]) by hub.org (8.9.3/8.9.3) with ESMTP id RAA35280; Fri, 20 Aug 1999 17:30:53 -0400 (EDT) (envelope-from alke@iol.it) Received: from dingo.alke.it ([212.52.76.254]) by mta4.iol.it (Netscape Messaging Server 3.61) with ESMTP id AAA6846; Fri, 20 Aug 1999 23:28:40 +0200 Received: from iol.it (riccio [192.168.0.10]) by dingo.alke.it (8.8.8/8.8.8/Debian/GNU) with ESMTP id XAA11222; Fri, 20 Aug 1999 23:32:09 +0200 Message-ID: <37BDC865.9BB15F3E@iol.it> Date: Fri, 20 Aug 1999 23:28:05 +0200 From: Alke X-Mailer: Mozilla 4.6 [en] (WinNT; I) X-Accept-Language: en MIME-Version: 1.0 To: "pgsql-general@postgresql.org" , "pgsql-sql@postgresql.org" Subject: Array-fields and many-to-many relations Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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