Robert Treat <[EMAIL PROTECTED]> writes:
> On Thu, 2002-09-26 at 17:22, Tom Lane wrote:
>> Robert Treat <[EMAIL PROTECTED]> 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

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to