pgsql: Detect mismatched CONTINUE and EXIT statements at plpgsql compil

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Detect mismatched CONTINUE and EXIT statements at plpgsql compil
Date: 2015-08-22 00:17:24
Message-ID: E1ZSwUu-0000Ms-Sv@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Detect mismatched CONTINUE and EXIT statements at plpgsql compile time.

With a bit of tweaking of the compile namestack data structure, we can
verify at compile time whether a CONTINUE or EXIT is legal. This is
surely better than leaving it to runtime, both because earlier is better
and because we can issue a proper error pointer. Also, we can get rid
of the ad-hoc old way of detecting the problem, which only took care of
CONTINUE not EXIT.

Jim Nasby, adjusted a bit by me

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/fcdfce6820373422bcdb5630f9eb63df14fd0764

Modified Files
--------------
src/pl/plpgsql/src/pl_comp.c | 4 +-
src/pl/plpgsql/src/pl_exec.c | 48 ++++---------------
src/pl/plpgsql/src/pl_funcs.c | 23 ++++++++-
src/pl/plpgsql/src/pl_gram.y | 70 ++++++++++++++++++++++-----
src/pl/plpgsql/src/plpgsql.h | 17 ++++++-
src/test/regress/expected/plpgsql.out | 85 ++++++++++++++++++++++++++-------
src/test/regress/sql/plpgsql.sql | 64 ++++++++++++++++++++-----
7 files changed, 226 insertions(+), 85 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2015-08-22 00:33:15 pgsql: Avoid O(N^2) behavior when enlarging SPI tuple table in spi_prin
Previous Message Stephen Frost 2015-08-21 19:51:50 pgsql: Clean up roles from roleattributes test