Re: Proposal: More flexible backup/restore via pg_dump
Stephan Szabo <sszabo@megazone23.bigpanda.com>
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Philip Warner <pjw@rhyme.com.au>
Cc: pgsql-hackers@postgresql.org
Date: 2000-06-27T20:10:00Z
Lists: pgsql-hackers
On Tue, 27 Jun 2000, Philip Warner wrote: > But the problem is the constraints: AFAIK there is no 'ALTER TABLE ADD > CONSTRAINT...' so PK, FK, Not Null constraints have to be applied before > data load (*please* tell me I'm wrong). This also means that for large > databases, I should apply indexes to make PK/FK checks fast, but they will > slow data load. Actually, there is an ALTER TABLE ADD CONSTRAINT for foreign key constraints. Of course, if the existing data fails the constraint the constraint doesn't get made. and if you're in a transaction, it'll force a rollback. In fact, you really can't always apply foreign key constraints at schema reload time because you can have tables with circular dependencies. Those would have to be created after data load.