foreign key support for inheritance - Mailing list pgsql-general

From Floyd Shackelford
Subject foreign key support for inheritance
Date
Msg-id 45EECC4B.6040107@fwshackelford.com
Whole thread Raw
Responses Re: foreign key support for inheritance  (Richard Huxton <dev@archonet.com>)
List pgsql-general
i would like to suggest the following modification to the foreign key
syntax (and underlying implementation) to support table inheritance:

  alter table [only] foo add foreign key (a_field) references [only] bar
(another_field) on delete restrict;

the only changes from the current syntax are the "[only]" modifiers
(pardon the pun) to the source and target tables. this modifier would
behave the same was as the "[only]" modifier in the "from [only]
foo_table" clause.

i really, really need foreign keys to support table inheritance. right
now, i have a script i run that generates 1000's of alter table commands
because i have to take into account not only the target table's
inheritance but the source table's inheritance too and all the
combinations of inheriting tables between them.

postgresql developers: please treat this as an enhancement request. i
think this would be a very popular enhancement.

--

Soli Deo gloria,

Floyd Shackelford


pgsql-general by date:

Previous
From: Harald Fuchs
Date:
Subject: Re: Importing *huge* mysql database into pgsql
Next
From: Sorin Schwimmer
Date:
Subject: query ... returned 4 columns