Thread: per-statement triggers

per-statement triggers

From
Neil Conway
Date:
This patch implements FOR EACH STATEMENT triggers, per my email to
-hackers a couple days ago.

Notes/caveats:

        - added regression tests for the new functionality, all
          regression tests pass on my machine

        - added pg_dump support

        - updated PL/PgSQL to support per-statement triggers; didn't
          look at the other procedural languages.

        - there's (even) more code duplication in trigger.c than there
          was previously. Any suggestions on how to refactor the
          ExecXXXTriggers() functions to reuse more code would be
          welcome -- I took a brief look at it, but couldn't see an
          easy way to do it (there are several subtly-different
          versions of the code in question)

        - updated the documentation. I also took the liberty of
          removing a big chunk of duplicated syntax documentation in
          the Programmer's Guide on triggers, and moving that
          information to the CREATE TRIGGER reference page.

        - I also included some spelling fixes and similar small
          cleanups I noticed while making the changes. If you'd like
          me to split those into a separate patch, let me know.

Cheers,

Neil

--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC

Attachment

Re: per-statement triggers

From
Bruce Momjian
Date:
Your patch has been added to the PostgreSQL unapplied patches list at:

    http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------


Neil Conway wrote:
> This patch implements FOR EACH STATEMENT triggers, per my email to
> -hackers a couple days ago.
>
> Notes/caveats:
>
>         - added regression tests for the new functionality, all
>           regression tests pass on my machine
>
>         - added pg_dump support
>
>         - updated PL/PgSQL to support per-statement triggers; didn't
>           look at the other procedural languages.
>
>         - there's (even) more code duplication in trigger.c than there
>           was previously. Any suggestions on how to refactor the
>           ExecXXXTriggers() functions to reuse more code would be
>           welcome -- I took a brief look at it, but couldn't see an
>           easy way to do it (there are several subtly-different
>           versions of the code in question)
>
>         - updated the documentation. I also took the liberty of
>           removing a big chunk of duplicated syntax documentation in
>           the Programmer's Guide on triggers, and moving that
>           information to the CREATE TRIGGER reference page.
>
>         - I also included some spelling fixes and similar small
>           cleanups I noticed while making the changes. If you'd like
>           me to split those into a separate patch, let me know.
>
> Cheers,
>
> Neil
>
> --
> Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: per-statement triggers

From
Bruce Momjian
Date:
Patch applied.  Thanks.

TODO marked as done:

* -Support statement-level triggers and triggers on columns (Neil)

---------------------------------------------------------------------------


Neil Conway wrote:
> This patch implements FOR EACH STATEMENT triggers, per my email to
> -hackers a couple days ago.
>
> Notes/caveats:
>
>         - added regression tests for the new functionality, all
>           regression tests pass on my machine
>
>         - added pg_dump support
>
>         - updated PL/PgSQL to support per-statement triggers; didn't
>           look at the other procedural languages.
>
>         - there's (even) more code duplication in trigger.c than there
>           was previously. Any suggestions on how to refactor the
>           ExecXXXTriggers() functions to reuse more code would be
>           welcome -- I took a brief look at it, but couldn't see an
>           easy way to do it (there are several subtly-different
>           versions of the code in question)
>
>         - updated the documentation. I also took the liberty of
>           removing a big chunk of duplicated syntax documentation in
>           the Programmer's Guide on triggers, and moving that
>           information to the CREATE TRIGGER reference page.
>
>         - I also included some spelling fixes and similar small
>           cleanups I noticed while making the changes. If you'd like
>           me to split those into a separate patch, let me know.
>
> Cheers,
>
> Neil
>
> --
> Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: per-statement triggers

From
Neil Conway
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> * -Support statement-level triggers and triggers on columns (Neil)

The latter part ("triggers on columns") is not done.

Cheers,

Neil

--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC

Re: per-statement triggers

From
Bruce Momjian
Date:
Thanks.  Split into two lines:

    * -Support statement-level triggers (Neil)
    * Support triggers on columns (Neil)

---------------------------------------------------------------------------

Neil Conway wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > * -Support statement-level triggers and triggers on columns (Neil)
>
> The latter part ("triggers on columns") is not done.
>
> Cheers,
>
> Neil
>
> --
> Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC
>
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073