Re: ALTER TABLE RENAME fix - Mailing list pgsql-patches

From Tom Lane
Subject Re: ALTER TABLE RENAME fix
Date
Msg-id 18241.1005450179@sss.pgh.pa.us
Whole thread Raw
In response to ALTER TABLE RENAME fix  (Brent Verner <brent@rcfile.org>)
Responses Re: ALTER TABLE RENAME fix
List pgsql-patches
Brent Verner <brent@rcfile.org> writes:
> exactly. which is why we've gotta inspecy the relname to determine
> which of the attnames to modify.

My point is that inspecting the tgfoid is safer, because it
unambiguously tells you what you are looking at.  The relname is
inherently ambiguous because it could be the same on both sides.
Also, depending on the relname is highly fragile if you're trying
to handle the RENAME TABLE case --- did you already update (one
side of) this trigger, or not?

> right.  I was not proposing that as any bit of info to use, just an
> example that there is no useful way (in a pg_trigger scan) to know
> if the relname is a PK or FK rel.

There is: the tgfoid, which is indirectly the same way that the trigger
functions themselves know what to do.

            regards, tom lane

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: ALTER TABLE RENAME fix
Next
From: Brent Verner
Date:
Subject: Re: ALTER TABLE RENAME fix