Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 0B6CE2E3D83 for ; Mon, 21 Jan 2008 07:17:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 93690-09 for ; Mon, 21 Jan 2008 07:16:59 -0400 (AST) Received: from ns1.officenet.no (ns1.officenet.no [193.212.174.3]) by postgresql.org (Postfix) with ESMTP id 1AC2B2E3D45 for ; Mon, 21 Jan 2008 07:16:59 -0400 (AST) Received: from [193.212.174.32] by ns1.officenet.no with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1JGudy-0004TK-QV for pgsql-sql@postgresql.org; Mon, 21 Jan 2008 12:16:53 +0100 From: Andreas Joseph Krogh Organization: OfficeNet AS To: pgsql-sql@postgresql.org Subject: Having elements of an int[]-array reference other tables Date: Mon, 21 Jan 2008 12:16:31 +0100 User-Agent: KMail/1.9.6 (enterprise 0.20070907.709405) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200801211216.31875.andreak@officenet.no> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/155 X-Sequence-Number: 30008 Hi. Is it possible in PG to have elements in an int[]-array reference another=20 int-column in another table? What I want is it to behave as a foreign key. create table master( my_id integer primary key ); create table test( id serial primary key, id_array integer[] references master(my_id) ); It would be nice if one could have elements in test.id_array to reference=20 elements in master.my_id, with all the benefits of ON DELETE | UPDATE etc. I know I can accomplish this with triggers, but if there exists something=20 built-in I'd like to know. =2D-=20 Andreas Joseph Krogh Senior Software Developer / Manager =2D-----------------------+---------------------------------------------+ OfficeNet AS | The most difficult thing in the world is to | Karenslyst All=C3=A9 11 | know how to do a thing and to watch | PO. Box 529 Sk=C3=B8yen | somebody else doing it wrong, without | 0214 Oslo | comment. | NORWAY | | Tlf: +47 24 15 38 90 | | =46ax: +47 24 15 38 91 | | Mobile: +47 909 56 963 | | =2D-----------------------+---------------------------------------------+