pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Detect mismatched CONTINUE and EXIT statements at plpgsql compil
Date: Sat, 22 Aug 2015 00:17:24 +0000
Message-ID: <E1ZSwUu-0000Ms-Sv@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1ZSwUu-0000Ms-Sv@gemulon.postgresql.org>
Permalink:  ../E1ZSwUu-0000Ms-Sv@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ZSwUu-0000Ms-Sv@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Detect mismatched CONTINUE and EXIT statements at plpgsql compil
  In-Reply-To: <E1ZSwUu-0000Ms-Sv@gemulon.postgresql.org>
  References: <E1ZSwUu-0000Ms-Sv@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox