Re: ERROR: UNIQUE constraint ... not found? - Mailing list pgsql-general

From Nigel J. Andrews
Subject Re: ERROR: UNIQUE constraint ... not found?
Date
Msg-id Pine.LNX.4.21.0304022352360.2573-100000@ponder.fairway2k.co.uk
Whole thread Raw
In response to Re: ERROR: UNIQUE constraint ... not found?  ("Ed L." <pgsql@bluepolka.net>)
List pgsql-general
On Wed, 2 Apr 2003, Ed L. wrote:

> > psql:test.sql:12: ERROR:  UNIQUE constraint matching given keys for
> > referenced table "person" not found
>
> Ah.  I was wondering why this didn't work anymore when it worked in 7.1.  I
> guess the change in SERIAL semantics where the unique index is no longer
> created is what causes the problem.  If I used PRIMARY KEY or create a
> unique index manually on person.id, it works fine.  It seems odd that one
> cannot have a foreign key to a non-indexed column in another table.
>

Well, I suppose a trigger on insert and update could be used to impose the
unique constraint, which is what the foriegn key needs, but then every check
and use wouldn't have an index it could potentially use for the lookup.


--
Nigel J. Andrews


pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: ERROR: UNIQUE constraint ... not found?
Next
From: "scott.marlowe"
Date:
Subject: date format