Re: plperl and triggers
От | Michael Fuhr |
---|---|
Тема | Re: plperl and triggers |
Дата | |
Msg-id | 20060911154434.GA306@winnie.fuhr.org обсуждение исходный текст |
Ответ на | plperl and triggers (James Cloos <cloos@jhcloos.com>) |
Ответы |
Re: plperl and triggers
|
Список | pgsql-docs |
On Sun, Sep 10, 2006 at 11:41:38PM -0400, James Cloos wrote: > The manual says that $_TD->{old} contains the old value of the row > being operated on in a trigger, and $_TD->{new} the new value to be > used istead. > > When using plpgsql I find that the equivs OLD and NEW do work that > way, but with plperlu there was only $_TD->{new}. Are you sure the tests were identical other than the trigger function language? Based on your description I'd guess that you did an UPDATE with PL/pgSQL and an INSERT with PL/PerlU. > Perhaps {old} is only set on an update. Or on an AFTER trigger to > an insert? > > Or perhaps {old} only gets set if {new} is altered? New and/or old rows are available in row-level BEFORE and AFTER triggers. New rows are available in INSERT and UPDATE triggers; old rows are available in UPDATE and DELETE triggers. This behavior should be the same in all languages; if you have an example that shows otherwise then please post it. > Whatever the reality, the doc should be fixed to explain exactly > when {old} and {new} exist and their semantics. "A patch would be welcome" :-) The PL/Perl documentation doesn't describe the semantics but the "Triggers" chapter does. If you've found a discrepancy between documentation and behavior then please post a self-contained test case. -- Michael Fuhr
В списке pgsql-docs по дате отправления: