X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9C4FF474E4F for ; Fri, 9 May 2003 17:20:19 -0400 (EDT) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id 9FB3A474E4F for ; Fri, 9 May 2003 17:19:43 -0400 (EDT) Received: by news.hub.org (Postfix, from userid 8) id 6B9F043A89E; Fri, 9 May 2003 17:19:43 -0400 (EDT) From: "Filipe Bonjour" Subject: Can arrays reference primary keys in CREATE TABLE? Date: Fri, 09 May 2003 23:21:25 +0200 User-Agent: Pan/0.13.3 (That cat's something I can't explain) Message-ID: X-Newsgroups: comp.databases.postgresql.sql MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Lines: 31 X-Complaints-To: abuse@swissonline.ch To: pgsql-sql@postgresql.org Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, hits=-4.5 required=5.0 tests=BAYES_10,NO_DNS_FOR_FROM,USER_AGENT version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/272 X-Sequence-Number: 13437 Hi, I'm a rather new SQL user, and I found interesting that you can use "references" to make sure that a value inserted in a table is a primary key from another table. Something like: create table ta ( a_id integer primary key ); create table tb ( a_ref integer references ta(a_id) ); However, I'd like to define a table containing an array, and that all elements of the array be a primary key from another table, so I tried: create table tb ( a_ref integer[] references ta(a_id) ); But that doesn't work, I think because an array of integers can't be directly compared to an integer. Is there a way to do this? (I'm using Red Hat 9 with PostgreSQL 7.3.2, by the way.) Thanks in advance for any answer or for pointing our where I can find it. Fil