[DOCS] plperl and triggers

2006-09-10 Thread James Cloos
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 <[EMAIL PROTECTED]> OpenPGP: 0xED7DAEA6

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [DOCS] plperl and triggers

2006-09-14 Thread James Cloos
> "Michael" == Michael Fuhr <[EMAIL PROTECTED]> writes:

Michael> Are you sure the tests were identical other than the trigger
Michael> function language?  Based on your description I'd guess that
Michael> you did an UPDATE with PL/pgSQL and an INSERT with PL/PerlU.

I was sure when I wrote that, but -- most embarrassingly -- I've not
been able to reproduce

In the exhausted euphoria of finishing a project I clearly [SIGH]
misremembered the steps along the way.

Apologies for the false alarm.

-JimC

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq