From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Check column list length in XMLTABLE/JSON_TABLE alias
Date: Wed, 18 May 2022 18:44:52 +0000
Message-ID: <E1nrOfE-001MRl-1w@gemulon.postgresql.org> (raw)
Check column list length in XMLTABLE/JSON_TABLE alias
We weren't checking the length of the column list in the alias clause of
an XMLTABLE or JSON_TABLE function (a "tablefunc" RTE), and it was
possible to make the server crash by passing an overly long one. Fix it
by throwing an error in that case, like the other places that deal with
alias lists.
In passing, modify the equivalent test used for join RTEs to look like
the other ones, which was different for no apparent reason.
This bug came in when XMLTABLE was born in version 10; backpatch to all
stable versions.
Reported-by: Wang Ke <krking@zju.edu.cn>
Discussion: https://postgr.es/m/17480-1c9d73565bb28e90@postgresql.org
Branch
------
REL_11_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/ba83de8ada5b4a179b93874f39241ed5e00226b2
Modified Files
--------------
src/backend/parser/parse_clause.c | 15 ---------------
src/backend/parser/parse_relation.c | 12 ++++++++++++
src/test/regress/expected/int2.out | 4 ++++
src/test/regress/expected/join.out | 3 +++
src/test/regress/expected/with.out | 5 +++++
src/test/regress/expected/xml.out | 3 +++
src/test/regress/sql/int2.sql | 4 ++++
src/test/regress/sql/join.sql | 3 +++
src/test/regress/sql/with.sql | 3 +++
src/test/regress/sql/xml.sql | 3 +++
10 files changed, 40 insertions(+), 15 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: alvherre@alvh.no-ip.org
Subject: Re: pgsql: Check column list length in XMLTABLE/JSON_TABLE alias
In-Reply-To: <E1nrOfE-001MRl-1w@gemulon.postgresql.org>
References: <E1nrOfE-001MRl-1w@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