]> granicus.if.org Git - postgresql/commit
Rearrange use of plpgsql_add_initdatums() so that only the parsing of a
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 8 Feb 2007 18:38:16 +0000 (18:38 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 8 Feb 2007 18:38:16 +0000 (18:38 +0000)
commitad7ee8883bf030c04262d6231d74650a409b08e7
treeec99c115acb555d215905b571b043eae21c2a6ee
parentdec65c942116f6b21222f29627a79cb133740879
Rearrange use of plpgsql_add_initdatums() so that only the parsing of a
DECLARE section needs to know about it.  Formerly, everyplace besides DECLARE
that created variables needed to do "plpgsql_add_initdatums(NULL)" to prevent
those variables from being sucked up as part of a subsequent DECLARE block.
This is obviously error-prone, and in fact the SQLSTATE/SQLERRM patch had
failed to do it for those two variables, leading to the bug recently exhibited
by Asif Ali Rehman: a DECLARE within an exception handler tried to reinitialize
SQLERRM.

Although the SQLSTATE/SQLERRM patch isn't in any pre-8.1 branches, and so
I can't point to a demonstrable failure there, it seems wise to back-patch
this into the older branches anyway, just to keep the logic similar to HEAD.
src/pl/plpgsql/src/gram.y
src/pl/plpgsql/src/pl_comp.c