Re: BUG #19695: JSON_VALUE ... RETURNING jsonb returns NULL for later evaluation once one evaluation returns NULL - Mailing list pgsql-bugs

From Manu
Subject Re: BUG #19695: JSON_VALUE ... RETURNING jsonb returns NULL for later evaluation once one evaluation returns NULL
Date
Msg-id 179019435414.699921.11893679831783704384@gmail.com
Whole thread
In response to Re: BUG #19695: JSON_VALUE ... RETURNING jsonb returns NULL for later evaluation once one evaluation returns NULL  (Srinath Reddy Sadipiralla <srinath2133@gmail.com>)
Responses Re: BUG #19695: JSON_VALUE ... RETURNING jsonb returns NULL for later evaluation once one evaluation returns NULL
List pgsql-bugs
Hi Srinath,

I tested your v1 on master, REL_18_STABLE and REL_17_STABLE, together
with Andrey's v2 for #19621 [1], which touches the same function.  Both
apply cleanly on all three branches, build without warnings, and the
main regression suite passes.  On all three,
JSON_VALUE(x, '$' RETURNING jsonb) over '1', 'null', '2' now returns
1, NULL, 2 (it was 1, NULL, NULL).

The fix looks right to me: that branch fills val_string but never
cleared the resnull left by an earlier row.

A small thing: git apply warns about trailing whitespace on four lines
of the new test in sqljson_queryfuncs.sql.

[1]
https://postgr.es/m/CAB8bMitawD=ERVLwYuDXvMT_OJqf+qAKx=3GEH6V_WHT7jnq7A@mail.gmail.com

Regards,
Manu



pgsql-bugs by date:

Previous
From: Manu
Date:
Subject: Re: BUG #19621: Unexpected results of JSON_VALUE with DEFAULT ON EMPTY
Next
From: Masahiko Sawada
Date:
Subject: Re: autovacuum: automatically propagate updated parameters