Re: INT array field referencing same table

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Gareth Kirwan <gbjk(at)thermeoneurope(dot)com>
Cc: <pgsql-admin(at)postgresql(dot)org>
Subject: Re: INT array field referencing same table
Date: 2002-10-23 13:10:18
Message-ID: 20021023060453.O3876-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Stephan Szabo 2002-10-23 13:11:42 Re: newbie psql - Backup/Restore - database
Previous Message Gareth Kirwan 2002-10-23 09:38:42 Re: INT array field referencing same table