Re: Shortcut for defining triggers

From: "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>
To: David Fetter <david(at)fetter(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Shortcut for defining triggers
Date: 2005-01-25 21:52:48
Message-ID: 20050125215248.GA67721@decibel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)decibel(dot)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?"

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-01-25 21:53:57 Re: Performance of the temporary table creation and use.
Previous Message Jim C. Nasby 2005-01-25 21:49:45 Re: Shortcut for defining triggers