CONSTRAINT REFERENCE betwen array to single

From: gustavo halperin <ggh(dot)develop(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: CONSTRAINT REFERENCE betwen array to single
Date: 2006-08-15 22:15:04
Message-ID: 44E24768.2010503@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

I have a table with an array of smallint that I want reference to a
column of smallint, see below:
/ database=# CREATE TABLE id_names ( id smallint CONSTRAINT the_id
PRIMARY KEY NOT NULL,
database(# name text CONSTRAINT the_name UNIQUE ) WITH OIDS;
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"the_id" for table "id_names"
NOTICE: CREATE TABLE / UNIQUE will create implicit index "the_name"
for table "id_names"
CREATE TABLE
database=# CREATE TABLE constrain_id ( id smallint[] CONSTRAINT
the_id_constr REFERENCES id_names (id) ) WITH OIDS;
ERROR: foreign key constraint "the_id_constr" cannot be implemented
DETAIL: Key columns "id" and "id" are of incompatible types:
smallint[] and smallint./
I mean, each of the possibles values in constrain_id.id[i] must be in
id_names.id . There are any way to do it with CONSTRAINT ???

Thank you very much,
Gustavo

Browse pgsql-general by date

  From Date Subject
Next Message Harvey, Allan AC 2006-08-15 23:17:19 Re: plpgsql dynamic queries and optional arguments
Previous Message John Purser 2006-08-15 21:16:58 Re: Changing the data directory Ubuntu