From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Support plpgsql variable names that conflict with unreserved SQL
Date: Fri, 04 Jan 2019 17:16:31 +0000
Message-ID: <E1gfT5D-00088N-0o@gemulon.postgresql.org> (raw)
Support plpgsql variable names that conflict with unreserved SQL keywords.
A variable name matching a statement-introducing keyword, such as
"comment" or "update", caused parse failures if one tried to write
a statement using that keyword. Commit bb1b8f69 already addressed
this scenario for the case of variable names matching unreserved
plpgsql keywords, but we didn't think about unreserved core-grammar
keywords. The same heuristic (viz, it can't be a variable name
unless the next token is assignment or '[') should work fine for
that case too, and as a bonus the code gets shorter and less
duplicative.
Per bug #15555 from Feike Steenbergen. Since this hasn't been
complained of before, and is easily worked around anyway,
I won't risk a back-patch.
Discussion: https://postgr.es/m/15555-149bbd70ddc7b4b6@postgresql.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/4879a5172af01dc05b6350dfa97ea1ac9a4c603c
Modified Files
--------------
src/pl/plpgsql/src/pl_comp.c | 13 +++---
src/pl/plpgsql/src/pl_scanner.c | 74 +++++++++++++++--------------------
src/pl/plpgsql/src/plpgsql.h | 2 +-
src/test/regress/expected/plpgsql.out | 21 ++++++++++
src/test/regress/sql/plpgsql.sql | 14 +++++++
5 files changed, 75 insertions(+), 49 deletions(-)
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: Support plpgsql variable names that conflict with unreserved SQL
In-Reply-To: <E1gfT5D-00088N-0o@gemulon.postgresql.org>
References: <E1gfT5D-00088N-0o@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