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