Re: Arrays and foreign keys

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Kaare Rasmussen <kar(at)webline(dot)dk>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Arrays and foreign keys
Date: 2000-08-09 17:52:17
Message-ID: Pine.BSF.4.10.10008091047260.59889-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Well, the two types aren't the same (one is an integer the
other an integer array,) so I wouldn't expect it to work. Note:
This shows another thing it probably should check before allowing
the constraint to be created.

I don't know if these belong in TODO, but this might
be the appropriate entry.
* Make sure that types used in foreign key constraints
are comparable.

Stephan Szabo
sszabo(at)bigpanda(dot)com

On Tue, 8 Aug 2000, Kaare Rasmussen wrote:

> Seems that it's not possible to combine arrays and foreign keys ?
>
> CREATE TABLE table1 (
> fld1 integer NOT NULL,
> number integer,
> level integer,
> PRIMARY KEY (fld1)
> );
>
> CREATE TABLE table2 (
> pkey integer NOT NULL,
> arvar integer[],
> PRIMARY KEY (pkey),
> FOREIGN KEY (arvar) REFERENCES table1(fld1)
> );
>
>
> This works, but the following insert complains that
>
> ERROR: Unable to identify an operator '=' for types 'int4' and '_int4'
> You will have to retype this query using an explicit cast

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Timothy H. Keitt 2000-08-09 18:32:04 Re: Arrays and foreign keys
Previous Message Oleg Bartunov 2000-08-09 15:31:16 VERY strange query plan (LONG)