Re: Reconstructing FKs in pg_dump - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Reconstructing FKs in pg_dump
Date
Msg-id 17170.1033078965@sss.pgh.pa.us
Whole thread Raw
In response to Re: Reconstructing FKs in pg_dump  (Robert Treat <xzilla@users.sourceforge.net>)
List pgsql-hackers
Robert Treat <xzilla@users.sourceforge.net> writes:
> On Thu, 2002-09-26 at 17:22, Tom Lane wrote:
>> Robert Treat <xzilla@users.sourceforge.net> writes:
> I'm trying to think of the cases where this extraction might fail, but
> maybe more important is what happens if it does fail? 
>> 
>> Then you have broken RI triggers ... which is the problem now.

> Uh...yeah, I got that part. I meant what will be done if/when it fails?
> Throw a WARNING and keep going? Throw an ERROR and die? 

What I was thinking of was to do the following in CREATE CONSTRAINT
TRIGGER:
if (no FROM clause){    try to extract table name from given tgargs;    try to look up table OID;    if successful,
inserttable OID into tgconstrrelid;}
 

If the lookup fails, you'd be left creating a constraint trigger with
zero tgconstrrelid, which is what's happening now.  That would error
out upon use (if it's really an RI trigger), thus alerting you that
you have a broken trigger.  (We could add a couple of lines in the
RI triggers to cause the error message to be more helpful than
"Relation 0 not found".)
        regards, tom lane


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Bug in PL/pgSQL GET DIAGNOSTICS?
Next
From: Peter Eisentraut
Date:
Subject: Re: AIX compilation problems (was Re: Proposal ...)