Re: ALTER TABLE ... REPLACE WITH - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: ALTER TABLE ... REPLACE WITH
Date
Msg-id 1292428213.1193.242.camel@ebony
Whole thread Raw
In response to Re: ALTER TABLE ... REPLACE WITH  (Csaba Nagy <ncslists@googlemail.com>)
Responses Re: ALTER TABLE ... REPLACE WITH  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Wed, 2010-12-15 at 12:17 +0100, Csaba Nagy wrote:

> But one problem would be when the replaced table is the _parent_ for a
> foreign key relationship. I don't think you can have that constraint
> pre-verified on the replacement table and simply replacing the content
> could leave the child relations with orphans. 

Good point.

The only sensible way to handle this is by putting the FK checks into
check pending state (as discussed on a different thread).

We would probably need to disallow FKs with DELETE or UPDATE CASCADE
since it would be difficult to execute those.

-- Simon Riggs           http://www.2ndQuadrant.com/books/PostgreSQL Development, 24x7 Support, Training and Services



pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: ALTER TABLE ... REPLACE WITH
Next
From: Florian Pflug
Date:
Subject: Re: hstores in pl/python