RENAME TRIGGER patch (was [HACKERS] Odd(?) RI-trigger behavior)

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)atentus(dot)com>, Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>, pgsql-patches(at)postgresql(dot)org
Subject: RENAME TRIGGER patch (was [HACKERS] Odd(?) RI-trigger behavior)
Date: 2002-04-20 00:47:02
Message-ID: 3CC0BA86.5080000@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Joe Conway <mail(at)joeconway(dot)com> writes:
>
>> There is already a RenameStmt node which is currently only used to
>> rename tables or table column names. Is there any objection to
>> modifying it to handle trigger names (and possibly other things in
>> the future) also?
>
>
> You'd need to add a field so you could distinguish the type of
> rename, but on the whole that seems a reasonable thing to do;
> probably better than adding a brand new node type. We're already
> sharing node types for DROPs, for example, so I see no reason not to
> do it for RENAMEs. (Cf 'DropPropertyStmt' in current sources)
>
> Renaming rules seems like something that should be on the list too, so
> you're right that there will be more stuff later.
>

Attached is a patch for ALTER TRIGGER RENAME per the above thread. I
left a stub for a future "ALTER RULE RENAME" but did not write that one
yet. Bruce, if you want to add my name for for that I'll take it and do
it later.

It passes all regression tests on my RH box. Usage is as follows:

test=# create table foo3(f1 int references foo2(f1));
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY
check(s)
CREATE
test=# \d foo3
Table "foo3"
Column | Type | Modifiers
--------+---------+-----------
f1 | integer |
Triggers: RI_ConstraintTrigger_16663

test=# alter trigger "RI_ConstraintTrigger_16663" on foo3 rename to
"MyOwnConstTriggerName";
ALTER
test=# \d foo3
Table "foo3"
Column | Type | Modifiers
--------+---------+-----------
f1 | integer |
Triggers: MyOwnConstTriggerName

Obviously there is no build in restriction on altering the name of
refint triggers -- is this a problem?

I'll follow up with a doc patch this weekend. If there are no
objections, please apply.

Thanks,

Joe

Attachment Content-Type Size
alter_trigger_rename.r0.patch text/plain 10.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Curt Sampson 2002-04-20 02:55:58 Re: general design question
Previous Message Tom Lane 2002-04-19 20:36:33 Re: Odd(?) RI-trigger behavior

Browse pgsql-patches by date

  From Date Subject
Next Message Thomas O'Dowd 2002-04-20 02:30:03 Re: [PATCHES] patch for ResultSet.java
Previous Message Tom Lane 2002-04-19 20:36:33 Re: Odd(?) RI-trigger behavior