plperl and triggers - Mailing list pgsql-docs

From James Cloos
Subject plperl and triggers
Date
Msg-id m3slizm5me.fsf@lugabout.jhcloos.org
Whole thread Raw
Responses Re: plperl and triggers
List pgsql-docs
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}.

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?

Whatever the reality, the doc should be fixed to explain exactly
when {old} and {new} exist and their semantics.

Liberal use of, eg, elog(WARNING, Dumper(\$_TD)) made it easy to
get my trigger function working as desired, but it would be cool
to document the details....

(In general, the docs are great.  I do sometimes have to read a
given section more than once -- or thrice -- to get it, but that
is as much due to fatigue as anything.  And I am one of those who
tend to learn new stuff better when reading from  paper than from
emitive displays like lcds or crts, for whatever reason.)

(Or maybe I'm just getting old. ;-)

-JimC
--
James Cloos <cloos@jhcloos.com>         OpenPGP: 0xED7DAEA6

pgsql-docs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: New XML section for documentation
Next
From: Michael Fuhr
Date:
Subject: Re: plperl and triggers