pg_restore order and check constraints - Mailing list pgsql-general

From Moshe Jacobson
Subject pg_restore order and check constraints
Date
Msg-id CAJ4CxLnapEfVNOJMNCXCg7Sf-Po=7y5=5bf2BkLqhSt1aTfEVw@mail.gmail.com
Whole thread Raw
Responses Re: pg_restore order and check constraints  (Martín Marqués <martin@2ndquadrant.com>)
List pgsql-general
Hi,

I recently added a check constraint onto a table in my database, that uses a stored procedure to check one of the inserted columns against the data of another table.

I know that this is stretching the limit of what a check constraint is meant to be, but is there a way, short of editing the pg_restore list manually every time, to guarantee that the table used for validation is populated before the table with the data being validated? 

Right now it is restoring out of order, and the table is not getting populated correctly.

if I have to rewrite as a trigger, I will do that, but I like the check constraint because it checks all of the entries when it's applied. Any suggestions?

--
Moshe Jacobson
Nead Werx, Inc. | Manager of Systems Engineering
2323 Cumberland Parkway, Suite 201 | Atlanta, GA 30339
moshe@neadwerx.com | 
www.neadwerx.com

"Quality is not an act, it is a habit." -- Aristotle

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: File System backup
Next
From: Tom Lane
Date:
Subject: Re: I want to make an example of using parameterized path