The use of arrays as foreign key - Mailing list pgsql-general

From Mourad EL HADJ MIMOUNE
Subject The use of arrays as foreign key
Date
Msg-id 006801c171d7$df496100$71a337c1@ensma.fr
Whole thread Raw
In response to SSL Connection via odbc  (Fernando San Martín Woerner <snmartin@galilea.cl>)
Responses Re: The use of arrays as foreign key
List 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 by date:

Previous
From: Tommi Mäkitalo
Date:
Subject: Re: anyone knows about pam_pgsql ?
Next
From: Fernando San Martín Woerner
Date:
Subject: RV: SSL Connection via odbc