Re: [BUGS] BUG #10728: json_to_recordset with nested json objects NULLs columns - Mailing list pgsql-hackers

From Merlin Moncure
Subject Re: [BUGS] BUG #10728: json_to_recordset with nested json objects NULLs columns
Date
Msg-id CAHyXU0zKHCX-onc-hULCtE9gx=xkB3d7DjNki5_DeHtAhKP=Bg@mail.gmail.com
Whole thread Raw
In response to Re: [BUGS] BUG #10728: json_to_recordset with nested json objects NULLs columns  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
On Tue, Jun 24, 2014 at 9:08 AM, Andrew Dunstan <andrew@dunslane.net> wrote:
> w.r.t. json arrays, I think you're chasing a chimera, since they are
> heterogenous, unlike SQL arrays.

But, there are many useful cases where the json is known to be well
formed, right?  Or do you mean that the difficulties stem from simply
validating the type?  Basically, I'm wondering if

SELECT to_json(foo_t[])

is ever going to be able to be reversed by:

SELECT array(json[b]_populate_recordset(null::foo_t[]), '...'::json[b])

...where foo_t is some arbitrarily complex nested type. even simpler
(although not necessarily faster) would be:

SELECT from_json(null::foo_t[], ',,,');

or even

SELECT '...'::foo_t[]::json::foo_t[];

My basic gripe with the json[b] APIs is that there is no convenient
deserialization reverse of to_json. Tom's proposal AIUI, in particular
having internal json arrays force to json, would foreclose the last
two cases from ever being possible.

merlin



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: idle_in_transaction_timeout
Next
From: Josh Berkus
Date:
Subject: Re: idle_in_transaction_timeout