postgresql/src/pl
Tom Lane 675a313b54 Fix an ancient logic error in plpgsql's exec_stmt_block: it thought it could
get away with not (re)initializing a local variable if the variable is marked
"isconst" and not "isnull".  Unfortunately it makes this decision after having
already freed the old value, meaning that something like

   for i in 1..10 loop
     declare c constant text := 'hi there';

leads to subsequent accesses to freed memory, and hence probably crashes.
(In particular, this is why Asif Ali Rehman's bug leads to crash and not
just an unexpectedly-NULL value for SQLERRM: SQLERRM is marked CONSTANT
and so triggers this error.)

The whole thing seems wrong on its face anyway: CONSTANT means that you can't
change the variable inside the block, not that the initializer expression is
guaranteed not to change value across successive block entries.  Hence,
remove the "optimization" instead of trying to fix it.
2007-02-08 18:38:31 +00:00
..
plperl Back-patch 8.0 version of plperl_hash_from_tuple() into prior releases 2005-01-26 17:09:28 +00:00
plpgsql Fix an ancient logic error in plpgsql's exec_stmt_block: it thought it could 2007-02-08 18:38:31 +00:00
plpython Fix three Python reference leaks in PLy_traceback(). This would result 2006-02-20 20:10:48 +00:00
tcl Support for qualified type names in PL/Tcl's spi_prepare command. 2003-10-30 02:00:44 +00:00
Makefile Turn on plpython build by default if we have something that looks like a 2001-08-27 00:29:49 +00:00