Re: Shortcut for defining triggers - Mailing list pgsql-hackers

From Jim C. Nasby
Subject Re: Shortcut for defining triggers
Date
Msg-id 20050125215248.GA67721@decibel.org
Whole thread Raw
In response to Re: Shortcut for defining triggers  (David Fetter <david@fetter.org>)
List pgsql-hackers
On Mon, Jan 24, 2005 at 07:49:54PM -0800, David Fetter wrote:
> > > Here's a sketch of what such an API might look like:
> > > 
> > > CREATE TRIGGER foo_trg
> > >     BEFORE INSERT OR UPDATE ON foo_tab
> > >     FOR EACH ROW EXECUTE PROCEDURE
>                      ^^^^^^^^^^^^^^^^^
> Maybe this should read "EXECUTE DYNAMIC PROCEDURE" or some such in
> order to make things easier on the parser.

Makes sense.

> > As for the function name, it seems you'd want the trigger name in
> > the function name somewhere.
> 
> No matter what you do, there has to be some kind of fallback for
> namespace collision.  How would this work?

How does SERIAL deal with this? It's the same issue; you're creating a
sequence with a pre-defined name based on the table and field name.

> I'd like to see some way to CALL anonymous blocks of [your favorite
> PL/], and this might even have something to do with what you're
> describing. :)

Agreed; being able to define anonymous plsql blocks is something I
definately miss in PostgreSQL.
-- 
Jim C. Nasby, Database Consultant               decibel@decibel.org 
Give your computer some brain candy! www.distributed.net Team #1828

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"


pgsql-hackers by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: Shortcut for defining triggers
Next
From: Tom Lane
Date:
Subject: Re: Performance of the temporary table creation and use.