postgresql/src/pl
Tom Lane d1be38cc7d 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:37:43 +00:00
..
plperl remove duplicate declaration, per report from Magnus Hagander. 2006-11-21 16:59:02 +00:00
plpgsql Fix an ancient logic error in plpgsql's exec_stmt_block: it thought it could 2007-02-08 18:37:43 +00:00
plpython Fix plpython to work (or at least pass its regression tests) with 2006-11-21 21:51:05 +00:00
tcl pgindent run for 8.2. 2006-10-04 00:30:14 +00:00
Makefile Convert the existing regression test scripts for the various optional 2005-05-14 17:55:22 +00:00