Re: pg_dump and ALTER TABLE / ADD FOREIGN KEY - Mailing list pgsql-hackers

From Christopher Kings-Lynne
Subject Re: pg_dump and ALTER TABLE / ADD FOREIGN KEY
Date
Msg-id 004b01c21a76$2f162a00$0200a8c0@SOL
Whole thread Raw
In response to pg_dump and ALTER TABLE / ADD FOREIGN KEY  ("Rod Taylor" <rbt@zort.ca>)
Responses Re: pg_dump and ALTER TABLE / ADD FOREIGN KEY  (Rod Taylor <rbt@zort.ca>)
List pgsql-hackers
> Some have expressed that this could be quite slow for large databases,
> and want a type of:
>
> SET CONSTRAINTS UNCHECKED;
>
> However, others don't believe constraints other than foreign keys
> should go unchecked.

Well, at the moment remember taht all that other SET CONSTRAINTS commands
only affect foreign keys.  However, this is a TODO to allow deferrable
unique constraints.

> Or would the below be more appropriate?:
> ALTER TABLE tab ADD FOREIGN KEY .... TRUST EXISTING DATA;

Maybe instead of TRUST EXISTING DATA, it could be just be WITHOUT CHECK or
something that uses existing keywords?

Either way, it must be a superuser-only command.  I'm kinda beginning to
favour the latter now actually...

Except if we could make all constraints uncheckable, then restoring a dump
would be really fast (but risky!)

Chris







pgsql-hackers by date:

Previous
From: Vince Vielhaber
Date:
Subject: Re: Our archive searching stinks
Next
From: "J. R. Nield"
Date:
Subject: Re: Index Scans become Seq Scans after VACUUM ANALYSE