Re: Reconstructing FKs in pg_dump

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Reconstructing FKs in pg_dump
Date: 2002-09-26 22:22:45
Message-ID: 17170.1033078965@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Treat <xzilla(at)users(dot)sourceforge(dot)net> writes:
> On Thu, 2002-09-26 at 17:22, Tom Lane wrote:
>> Robert Treat <xzilla(at)users(dot)sourceforge(dot)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, insert table 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-09-26 22:25:23 Re: Reconstructing FKs in pg_dump
Previous Message Stephan Szabo 2002-09-26 22:10:35 Re: Reconstructing FKs in pg_dump