pgsql: Only allow returning string types or bytea from json_serialize

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Only allow returning string types or bytea from json_serialize
Date: 2022-07-07 21:46:12
Message-ID: E1o9ZK7-001hML-4h@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Only allow returning string types or bytea from json_serialize

These are documented to be the allowed types for the RETURNING clause,
but the restriction was not being enforced, which caused a segfault if
another type was specified. Add some testing for this.

Per report from a.kozhemyakin

Backpatch to release 15.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3c633f32b9c712cc0b4c8d946f0eeae04a3ff51a

Modified Files
--------------
src/backend/parser/parse_expr.c | 17 +++++++++++++++++
src/test/regress/expected/sqljson.out | 10 ++++++++++
src/test/regress/sql/sqljson.sql | 5 +++++
3 files changed, 32 insertions(+)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2022-07-08 02:18:20 pgsql: Remove HP-UX port.
Previous Message Tom Lane 2022-07-07 15:24:04 pgsql: Remove stray references to lefttree/righttree in the executor.