Search Postgresql Archives

CONSTRAINT REFERENCE betwen array to single

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux