From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add the ability for the core grammar to have more than one parse
Date: Mon, 04 Jan 2021 17:39:40 +0000
Message-ID: <E1kwTpU-0000yR-PX@gemulon.postgresql.org> (raw)
Add the ability for the core grammar to have more than one parse target.
This patch essentially allows gram.y to implement a family of related
syntax trees, rather than necessarily always parsing a list of SQL
statements. raw_parser() gains a new argument, enum RawParseMode,
to say what to do. As proof of concept, add a mode that just parses
a TypeName without any other decoration, and use that to greatly
simplify typeStringToTypeName().
In addition, invent a new SPI entry point SPI_prepare_extended() to
allow SPI users (particularly plpgsql) to get at this new functionality.
In hopes of making this the last variant of SPI_prepare(), set up its
additional arguments as a struct rather than direct arguments, and
promise that future additions to the struct can default to zero.
SPI_prepare_cursor() and SPI_prepare_params() can perhaps go away at
some point.
Discussion: https://postgr.es/m/4165684.1607707277@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/844fe9f159a948377907a63d0ef3fb16dc51ce50
Modified Files
--------------
doc/src/sgml/spi.sgml | 126 +++++++++++++++++++++++++++++++++++
src/backend/commands/tablecmds.c | 2 +-
src/backend/executor/spi.c | 52 ++++++++++++++-
src/backend/parser/gram.y | 22 +++++-
src/backend/parser/parse_coerce.c | 5 +-
src/backend/parser/parse_type.c | 64 ++----------------
src/backend/parser/parser.c | 27 ++++++--
src/backend/tcop/postgres.c | 2 +-
src/include/executor/spi.h | 13 +++-
src/include/executor/spi_priv.h | 1 +
src/include/parser/parser.h | 20 +++++-
src/interfaces/ecpg/preproc/parse.pl | 2 +-
src/pl/plpgsql/src/pl_exec.c | 13 ++--
src/pl/plpgsql/src/pl_gram.y | 2 +-
14 files changed, 268 insertions(+), 83 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: Add the ability for the core grammar to have more than one parse
In-Reply-To: <E1kwTpU-0000yR-PX@gemulon.postgresql.org>
References: <E1kwTpU-0000yR-PX@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