]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix EXIT out of outermost block in plpgsql.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 13 Sep 2021 16:42:03 +0000 (12:42 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 13 Sep 2021 16:42:03 +0000 (12:42 -0400)
commitbdd6ce48d0356fbfaa0fe4a1fee20068f99abb70
tree4d1bf1fc36cd49f150bf8eb92ab95f16da1280fc
parentb6a10ff4abe9538f16d9f52bda6bc04f90b77d0d
Fix EXIT out of outermost block in plpgsql.

Ordinarily, using EXIT this way would draw "control reached end of
function without RETURN".  However, if the function is one where we
don't require an explicit RETURN (such as a DO block), that should
not happen.  It did anyway, because add_dummy_return() neglected to
account for the case.

Per report from Herwig Goemans.  Back-patch to all supported branches.

Discussion: https://postgr.es/m/868ae948-e3ca-c7ec-95a6-83cfc08ef750@gmail.com
src/pl/plpgsql/src/expected/plpgsql_control.out
src/pl/plpgsql/src/pl_comp.c
src/pl/plpgsql/src/sql/plpgsql_control.sql