Re: pg_restore --disable-triggers does not stop triggers - Mailing list pgsql-general

From CN
Subject Re: pg_restore --disable-triggers does not stop triggers
Date
Msg-id 1128684567.28473.244633640@webmail.messagingengine.com
Whole thread Raw
In response to Re: pg_restore --disable-triggers does not stop triggers  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Tom,

Thank you very much for the enlightenment again!

> > I notice that PostgreSQL does disable triggers but it seems to not
> > disable CHECK constraint:
>
> Why should it?
>
> (Hint: a check constraint that looks at anything but the row being
> checked is broken by definition.)

Maybe my case is rare in the real world, but this is my problem:

I use CHECK(MyFunc(column_1,column_2)) because foreign key constraint is
insufficient to do the complicate check for that table. Such design
works well for production run but problem happens during database
restore. It happens because MyFunc() raises exception as the data of
this table with CHECK constraint is being restored before the data of
the table(s) referenced by MyFunc().

Is it a wise request for one more option to be added to pg_restore to
disable CHECK constraint?

Best Regards,

CN

--
http://www.fastmail.fm - Accessible with your email software
                          or over the web


pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Shell script to extract a table from a plain text dump
Next
From: Moises Alberto Lindo Gutarra
Date:
Subject: Re: How to delete Large Object from Database?