Thread: pgsql: Only allow returning string types or bytea from json_serialize

pgsql: Only allow returning string types or bytea from json_serialize

From
Andrew Dunstan
Date:
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
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2b2bcc22e571c27a9ea8861e29e0c40874dae714

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(+)