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

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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: alter_trigger_rename.r0.patch
Description: text/plain (10.3 KB)

In response to

Responses

pgsql-hackers by date

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

pgsql-patches by date

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

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