I have a database with the following structure:
Create table bar...
Create function subset_of_bar ... (which does a select on a subset of bar)
Create table foo...
Alter table foo add constraint mycheck check subset_of_bar(id);
I pg_dumped my database, and tried to pg_restore it on another
On 08/07/2014 10:00 AM, Chris Curvey wrote:
I’ve done some searching and am coming up empty. Is there a way to get
pg_restore to apply constraints AFTER loading all the tables
Kinda. PostgreSQL applies constraints with hidden system-level triggers.
An easy way to turn them off is to use
On 08/07/2014 01:09 PM, Chris Curvey wrote:
The disable trigger statement runs without error, but does not seem
to have any effect.
:(
Apparently this trick only works for disabling foreign keys. I'm not
sure how to temporarily disable check constraints. You might have to
drop the
-Original Message-
From: Shaun Thomas [mailto:stho...@optionshouse.com]
Sent: Thursday, August 07, 2014 12:43 PM
To: Chris Curvey; pgsql-general@postgresql.org
Subject: Re: [GENERAL] dump/restore with a hidden dependency?
On 08/07/2014 10:00 AM, Chris Curvey wrote:
I've done
Chris Curvey ccur...@zuckergoldberg.com writes:
I have a database with the following structure:
Create table bar...
Create function subset_of_bar ... (which does a select on a subset of bar)
Create table foo...
Alter table foo add constraint mycheck check subset_of_bar(id);
Basically, that's
-Original Message-
From: Tom Lane [mailto:t...@sss.pgh.pa.us]
Sent: Thursday, August 07, 2014 2:50 PM
To: Chris Curvey
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] dump/restore with a hidden dependency?
Chris Curvey ccur...@zuckergoldberg.com writes:
I have a database
Chris Curvey-3 wrote
-Original Message-
From: Tom Lane [mailto:
tgl@.pa
]
Sent: Thursday, August 07, 2014 2:50 PM
To: Chris Curvey
Cc:
pgsql-general@
Subject: Re: [GENERAL] dump/restore with a hidden dependency?
Chris Curvey lt;
ccurvey@
gt; writes:
I have a database
Chris Curvey ccur...@zuckergoldberg.com wrote:
Perhaps a pair of triggers? An insert-or-update trigger on foo, and a
delete-or-update trigger on bar?
Using a foreign key constraint is best if that can do the right
thing. If that doesn't work, triggers like you describe are
probably the best