Re: BUG #13680: PostgreSQL backend process crashes on jsonb_object_agg() in plpgsql recursive function - Mailing list pgsql-bugs

From Michael Paquier
Subject Re: BUG #13680: PostgreSQL backend process crashes on jsonb_object_agg() in plpgsql recursive function
Date
Msg-id CAB7nPqQJab1d6EY3O=ZhG8VORXP01PjeMGSoELEZNzEELhfkkw@mail.gmail.com
Whole thread Raw
In response to BUG #13680: PostgreSQL backend process crashes on jsonb_object_agg() in plpgsql recursive function  (b.yordanov2@gmail.com)
Responses Re: BUG #13680: PostgreSQL backend process crashes on jsonb_object_agg() in plpgsql recursive function  (boyko yordanov <b.yordanov2@gmail.com>)
List pgsql-bugs
On Thu, Oct 15, 2015 at 7:07 PM, boyko yordanov wrote:
> sravni_hstore=# select ('{"3": {"9703": {"c": 1}}}'::jsonb->'3') || ('{"3":
> {"8309": {"c": 1}}}'::jsonb->'3');
> -[ RECORD 1 ]----------------------------------
> ?column? | {"8309": {"c": 1}, "9703": {"c": 1}}
>
> sravni_hstore=# select '{"3": {"9703": {"c": 1}}}'::jsonb->'3' || '{"3":
> {"8309": {"c": 1}}}'::jsonb->'3';
> -[ RECORD 1 ]----------------
> ?column? | {"8309": {"c": 1}}
>
> What I expect is that there should be no difference in the output of the
> last two queries. Not sure if I should submit this as a separate bug?

The last one looks correct to me, the concat operator is using on the
right side '{"3": {"8309": {"c": 1}}}'::jsonb in your last query, and
not '{"3": {"8309": {"c": 1}}}'::jsonb->'3', so || takes precedence on
->. When applying the parenthesis, ('{"3": {"8309": {"c":
1}}}'::jsonb->'3') is completely taken into account.
--
Michael

pgsql-bugs by date:

Previous
From: Michael Paquier
Date:
Subject: Re: BUG #13680: PostgreSQL backend process crashes on jsonb_object_agg() in plpgsql recursive function
Next
From: Amit Kapila
Date:
Subject: Re: PQexec() hangs on OOM