Fix EXIT out of outermost block in plpgsql.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: a460f7eb3d5ab269fa72f0b4350e561ec158b0e7
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2021-09-13T16:42:04Z
Releases: 9.6.24
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

Files

PathChange+/−
src/pl/plpgsql/src/pl_comp.c modified +4 −2

Discussion