]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix plpgsql's exec_eval_expr() to ensure it returns a sane type OID
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 14 Apr 2010 23:52:16 +0000 (23:52 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 14 Apr 2010 23:52:16 +0000 (23:52 +0000)
commitacbee0efbcb010a43d3ca77355a311ef1a68868c
tree2999e419e1e485b86722d36a8eecb3271d7d38fb
parentb090207cde3e6c3de12ba94b145eac83828f75b9
Fix plpgsql's exec_eval_expr() to ensure it returns a sane type OID
even when the expression is a query that returns no rows.

So far as I can tell, the only caller that actually fails when a garbage
OID is returned is exec_stmt_case(), which is new in 8.4 --- in all other
cases, we might make a useless trip through casting logic, but we won't
fail since the isnull flag will be set.  Hence, backpatch only to 8.4,
just in case there are apps out there that aren't expecting an error to
be thrown if the query returns more or less than one column.  (Which seems
unlikely, since the error would be thrown if the query ever did return a
row; but it's possible there's some never-exercised code out there.)

Per report from Mario Splivalo.
src/pl/plpgsql/src/pl_exec.c