Re: pgsql: Fix json_to_record() bug with nested objects.

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Fix json_to_record() bug with nested objects.
Date: 2016-03-03 13:06:47
Message-ID: 56D836E7.4010007@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On 03/02/2016 11:31 PM, Tom Lane wrote:
> I added a regression test case based on his example, plus parallel tests
> for json_to_recordset, jsonb_to_record, jsonb_to_recordset. The latter
> three do not exhibit the same bug (which suggests that we may be missing
> some opportunities to share code...)

Not really. The jsonb variants don't do any re-parsing at all, so
lex_level simply doesn't come into play, and for json_to_recordset we
want things from lex_level 2, not 1, as the json is supposed to be an
array of objects instead of just an object.

That's not to say that the code can't be improved - It very probably can.

cheers

andrew

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2016-03-03 15:54:36 pgsql: Fix mistakes in recovery tests
Previous Message Simon Riggs 2016-03-03 09:54:00 pgsql: Revert buggy optimization of index scans