PLPGSQL OID Bug
This patch will resolve the oid retrieval bugs from plpgsql. There are however several other places where isnull=false was removed and replaced with isnull which may also need to be corrected.
Kevin McArthur
StormTide Digital Studios Inc.
Index: src/pl/plpgsql/src/pl_exec.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v
retrieving revision 1.149
diff -c -r1.149 pl_exec.c
*** src/pl/plpgsql/src/pl_exec.c 26 Jun 2005 22:05:42 -0000 1.149
--- src/pl/plpgsql/src/pl_exec.c 27 Jul 2005 20:38:25 -0000
***************
*** 1143,1149 ****
{
PLpgSQL_diag_item *diag_item = (PLpgSQL_diag_item *) lfirst(lc);
PLpgSQL_datum *var;
! bool isnull;
if (diag_item->target <= 0)
continue;
--- 1143,1149 ----
{
PLpgSQL_diag_item *diag_item = (PLpgSQL_diag_item *) lfirst(lc);
PLpgSQL_datum *var;
! bool isnull=false;
if (diag_item->target <= 0)
continue;
"Kevin McArthur" <Kevin@StormTide.ca> writes:
This patch will resolve the oid retrieval bugs from plpgsql.
Applied.
There are
however several other places where isnull=false was removed and
replaced with isnull which may also need to be corrected.
The other spots seem to be OK. Thanks for the report and fix!
regards, tom lane
Tom Lane wrote:
The other spots seem to be OK. Thanks for the report and fix!
Woops, my apologies for introducing the bug. In general I think it's
worth removing explicit initialization of out parameters unless that
initialization is actually needed. I thought I had checked that
`isnull=false' wasn't needed, but obviously I missed a case.
BTW, is there a reason why exec_cast_value() and friends take a bool *,
rather than a bool?
-Neil
Neil Conway <neilc@samurai.com> writes:
BTW, is there a reason why exec_cast_value() and friends take a bool *,
rather than a bool?
I think the reason is that it's both an input and an output parameter,
to handle the case where the cast function returns NULL.
This is obviously a pretty bug-prone convention, however, and so maybe
we should rethink it.
regards, tom lane
Tom Lane wrote:
I think the reason is that it's both an input and an output parameter,
to handle the case where the cast function returns NULL.
The only reference to `isnull' in the body of exec_cast_value() is:
if (!*isnull)
{
/* ... */
}
i.e. it is never referenced again, let alone written through. Barring
any objections I'll apply the attached patch tomorrow.
-Neil