| От | gustavo halperin |
|---|---|
| Тема | CONSTRAINT REFERENCE betwen array to single |
| Дата | |
| Msg-id | 44E24768.2010503@gmail.com обсуждение исходный текст |
| Список | 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
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера