Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-hackers by date

Next:From: Tom LaneDate: 2002-09-26 22:25:23
Subject: Re: Reconstructing FKs in pg_dump
Previous:From: Stephan SzaboDate: 2002-09-26 22:10:35
Subject: Re: Reconstructing FKs in pg_dump

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group