From: Filipe Bonjour <fbonjour@urbanet.ch>
To: pgsql-sql@postgresql.org
Subject: Can arrays reference primary keys in CREATE TABLE?
Date: Fri, 09 May 2003 23:21:25 +0200
Message-ID: <pan.2003.05.09.21.21.24.908732@urbanet.ch> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: fbonjour@urbanet.ch
Subject: Re: Can arrays reference primary keys in CREATE TABLE?
In-Reply-To: <pan.2003.05.09.21.21.24.908732@urbanet.ch>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox