The use of arrays as foreign key
| От | Mourad EL HADJ MIMOUNE |
|---|---|
| Тема | The use of arrays as foreign key |
| Дата | |
| Msg-id | 006801c171d7$df496100$71a337c1@ensma.fr обсуждение исходный текст |
| Ответ на | SSL Connection via odbc (Fernando San Martín Woerner <snmartin@galilea.cl>) |
| Ответы |
Re: The use of arrays as foreign key
|
| Список | pgsql-general |
Hi,
I'am trying to use foreign key constraint on column of type int[] (
array ) without success.
Exemple:
Create table course (id serial, name varchar);
Create table student (id serial, name varchar, course int[3], Constraint
f_key Foreign key (course) references course (id));
plib_gene=# insert into course (name) values ('math');
INSERT 600730 1
plib_gene=# insert into course (name) values ('info');
INSERT 600731 1
plib_gene=# insert into course (name) values ('phys');
INSERT 600732 1
plib_gene=# insert into course (name) values ('chimie');
INSERT 600733 1
plib_gene=# insert into course (name) values ('sport');
INSERT 600734 1
plib_gene=# insert into student (name, course) values ('mourad', '{1,2,3}');
ERROR: Unable to identify an operator '=' for types 'int4' and '_int4'
You will have to retype this query using an explicit cast
I have installed a new operators on array types by using functions from the
contrib/array directory of postgresql source.
But I obtained the same error message.
Why we can't use OID as a foreign key?
What this the utility of OIDVECTOR?
Thanks for your help.
Mourad.
В списке pgsql-general по дате отправления: