Обсуждение: pgsql: Only allow returning string types or bytea from json_serialize
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(+)
Re: pgsql: Only allow returning string types or bytea from json_serialize
От
Kyotaro Horiguchi
Дата:
At Thu, 07 Jul 2022 21:46:12 +0000, Andrew Dunstan <andrew@dunslane.net> wrote in
> Only allow returning string types or bytea from json_serialize
I noticed that this introcues the following error message.
+ errmsg("cannot use RETURNING type %s in JSON_SERIALIZE"
+ format_type_be(returning->typid)),
However, the same file has the following error message.
> errmsg("cannot use RETURNING type %s in %s",
> format_type_be(returning->typid), fname),
So, couldn't we share the format string to reduce translatable
messages?
And, the other messages are
cannot use RETURNING type %s in JSON_SCALAR(), and
cannot use RETURNING type %s in JSON()
So, I think this should not be
cannot use RETURNING type %s in JSON_SERIALIZE
, but should be
cannot use RETURNING type %s in JSON_SERIALIZE()
regards.
--
Kyotaro Horiguchi
NTT Open Source Software Center
Вложения
On Fri, Jul 08, 2022 at 03:41:35PM +0900, Kyotaro Horiguchi wrote:
> I noticed that this introcues the following error message.
>
> + errmsg("cannot use RETURNING type %s in JSON_SERIALIZE"
> + format_type_be(returning->typid)),
>
> However, the same file has the following error message.
>
> > errmsg("cannot use RETURNING type %s in %s",
> > format_type_be(returning->typid), fname),
>
> So, couldn't we share the format string to reduce translatable
> messages?
Yeah, I think that you are right, so let's fix this. If Andrew does
not show up, I'll take care of it.
--
Michael
Вложения
On Fri, Jul 08, 2022 at 07:20:14PM +0900, Michael Paquier wrote: > Yeah, I think that you are right, so let's fix this. If Andrew does > not show up, I'll take care of it. Okay, this one is done, then. Thanks for the patch, Horiguchi-san. -- Michael
Вложения
Re: pgsql: Only allow returning string types or bytea from json_serialize
От
Kyotaro Horiguchi
Дата:
At Mon, 11 Jul 2022 12:49:11 +0900, Michael Paquier <michael@paquier.xyz> wrote in > On Fri, Jul 08, 2022 at 07:20:14PM +0900, Michael Paquier wrote: > > Yeah, I think that you are right, so let's fix this. If Andrew does > > not show up, I'll take care of it. > > Okay, this one is done, then. Thanks for the patch, Horiguchi-san. Thanks! (I came to notice that I sent the mail only to -commiters..) regards. -- Kyotaro Horiguchi NTT Open Source Software Center