Re: Shorthand syntax for triggers
| От | Craig Ringer |
|---|---|
| Тема | Re: Shorthand syntax for triggers |
| Дата | |
| Msg-id | 5076558B.4080102@ringerc.id.au обсуждение исходный текст |
| Ответ на | Shorthand syntax for triggers (Joe Van Dyk <joe@tanga.com>) |
| Список | pgsql-general |
On 10/11/2012 12:22 AM, Joe Van Dyk wrote:
> 3. Triggers can access a special CHANGED value that's either NEW for
> insert or updates, or OLD for deletes.
I'm not a big fan of the prior comments about small syntax changes, but
this would simplify quite a bit of code. I'd *really* like a way to
refer to "NEW for INSERT or UPDATE, OLD for DELETE" as an implicit
automatic variable.
I do see the appeal of making trigger functions anonymous, but I really
doubt it's worth the hassle.
> 4. Default for 'after insert' triggers is to return null, as I believe
> it doesn't matter what you return here.
This is a trivial convenience, but not one I'd be against.
> 5. Way less repetitive typing.
If you're repeating the same triggers over and over you may want to look
at writing them to be re-usable. See eg:
http://wiki.postgresql.org/wiki/Audit_trigger_91plus
--
Craig Ringer
В списке pgsql-general по дате отправления: