Re: bug report

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martin Renters <martin(at)datafax(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: bug report
Date: 2000-04-28 03:59:38
Message-ID: 2142.956894378@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Martin Renters <martin(at)datafax(dot)com> writes:
> Backend crash with attached script

> The original issue that triggered this was an attempt to implement field
> auditing in 7.0beta3. It worked fine as long as the fields were not NULL.
> I've simplified the code as much as possible to only print values
> rather than writing them into an audit table.

> In particular, in the trigger the values printed for old and new are
> correct if the field being updated is non NULL. If either the old or new
> value for the field is NULL then the values printed in the notice are
> wrong.

I've fixed the immediate coredump exhibited by your script, which is
that the plpgsql RAISE statement was careless about checking for a NULL
value supplied to it. But I suspect that that was not your original
problem but was something you tripped over while investigating it.

Most likely, your real problem is this: at present, a called function
cannot distinguish which of its arguments are NULL --- if any of them
are NULL, then all appear to be (and the function's result is forced
to be NULL, too, which might make one wonder why it's executed at all).
This happens because the function call protocol only provides a single
isNull flag for the entire call operation.

This problem doesn't arise for triggers, since the data is not passed
to them as parameters, but it's a big problem for any functions you
call from the trigger.

Revising the function call protocol is high on our to-do list for 7.1.

regards, tom lane

In response to

  • bug report at 2000-04-27 16:04:11 from Martin Renters

Browse pgsql-bugs by date

  From Date Subject
Next Message Vashenko Maxim 2000-04-28 07:00:25 security problem ?
Previous Message Tom Lane 2000-04-27 20:34:07 Re: postgres 7.0 beta 2 segfaulting [linux i386]