Re: INT array field referencing same table - Mailing list pgsql-admin

From Stephan Szabo
Subject Re: INT array field referencing same table
Date
Msg-id 20021023060453.O3876-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Re: INT array field referencing same table  ("Gareth Kirwan" <gbjk@thermeoneurope.com>)
List pgsql-admin
On Wed, 23 Oct 2002, Gareth Kirwan wrote:

> Gareth StationeryFurther information:
>
> I've now tried this ( I would have tried it first but the server was having
> it's nappy changed.
> It seems to have a problem with the notion that the individual items of the
> array are the references to the id, rather than the array itself.
> How can I tell it this?
> Am I missing something in the documentation that tells me how to do this?

You can't tell it that. The types on both sides of a foreign key
constraint need to be of comparable types (in this case defined as
having an = operator).  int[] and int aren't comparable.  There's
occasionally been talk about making type[]->type foreign keys
use element in array rather than equality, but since type[] could
be a multidimensional array I'm not sure that's well defined.

> Raw Error:
> ERROR:  Unable to identify an operator '=' for types 'integer[]' and
> 'integer'
>         You will have to retype this query using an explicit cast



pgsql-admin by date:

Previous
From: markus.cl@gmx.de (Markus Dehmann)
Date:
Subject: Print line?
Next
From: Stephan Szabo
Date:
Subject: Re: newbie psql - Backup/Restore - database