Re: Foreign key to base table with rows in inherited tables

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Mikael Kjellstrm <mikael(dot)kjellstrom(at)_no_spam_flygtaxi(dot)se>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Foreign key to base table with rows in inherited tables
Date: 2001-06-12 17:01:29
Message-ID: Pine.BSF.4.21.0106120958580.53490-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Yes, you cannot currently do this. Check past discussions on mailing
lists for more details. Inheritance and constraints is pretty dodgy
right now (for instance, Reservationfile.datafileNr is not unique).

On Tue, 5 Jun 2001, Mikael Kjellstrm wrote:

> I've declared a foreign key in table FileId referencing the primary key in
> Datafile. Datafile in itself does'nt have any rows, but Reservationfile,
> inheriting from Datafile has.
>
> I can't insert a row in FileId because no row is found in Datafile: this is
> not what I expected.
>
> I've tried suffixing Datafile with an asterisk (even though that shouldn't
> be necessary in 7.1), but that's not valid syntax.
>
> I'm running 7.1.release4 on Debian Woody.
>
> Table definitions for clarity:
>
> -- Has no rows of its own
> declare Datafile (
> datafileNr not null primary key
> );
> -- This one has rows
> declare Reservationfile (
> )
> inherits(Datafile)
> ;
> declare FileId (
> datafileNr not null
> references Datafile
> );

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Mathijs Brands 2001-06-12 17:03:42 Re: Cluster and primary key
Previous Message Martín Marqués 2001-06-12 15:17:13 Re: tables, permissions, sequences