Re: Foreign key constraints on inherited columns, 2 errors.

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: sdeasey(at)bigfoot(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Foreign key constraints on inherited columns, 2 errors.
Date: 2001-05-16 17:23:12
Message-ID: Pine.BSF.4.21.0105161020260.28232-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, 16 May 2001 pgsql-bugs(at)postgresql(dot)org wrote:

> Stephen Deasey (sdeasey(at)bigfoot(dot)com) reports a bug with a severity of 2
> The lower the number the more severe it is.
>
> Short Description
> Foreign key constraints on inherited columns, 2 errors.
>
> Long Description
> Using the Postgres 7.1.1 RPMs I typed the following into psql:
>
> =# create table foo (foo integer);
> CREATE
> =# create table bar (bar integer) inherits(foo);
> CREATE
> =# create table baz (baz integer references bar(foo));
> NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
> ERROR: UNIQUE constraint matching given keys for referenced table "bar" not found
>
>
> I think this is incorrect, and it is not the behaviour I was seeing
> with version 7.0.3 where it worked as expected.

No, actually it didn't really. If bar had non-unique values the
references constraint would do fairly random bad things. SQL
requires the unique constraint on the columns, and so do we now.
Just add a UNIQUE(foo) to bar's definition and it should work.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2001-05-16 17:27:47 Re: Bug in configure.in, minor annoyance, PostgreSQL 7.2devel & FreeBSD 2.2.8
Previous Message Todd R. Eigenschink 2001-05-16 16:26:53 Re: REQ: build src/backend/postgres w/o -lncurses or -lreadline