Only allow returning string types or bytea from json_serialize
authorAndrew Dunstan <andrew@dunslane.net>
Thu, 7 Jul 2022 21:40:02 +0000 (17:40 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Thu, 7 Jul 2022 21:45:47 +0000 (17:45 -0400)
commit2b2bcc22e571c27a9ea8861e29e0c40874dae714
treec782b50bb528f2256b82cf7d230689bad6f3dec1
parentea9e59d701b3bfdfebcc67647ed203fa22eed9b0
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.
src/backend/parser/parse_expr.c
src/test/regress/expected/sqljson.out
src/test/regress/sql/sqljson.sql