Re: [BUGS] BUG #10728: json_to_recordset with nested json objects NULLs columns

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, matti(dot)hameister(at)technologygroup(dot)de, pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [BUGS] BUG #10728: json_to_recordset with nested json objects NULLs columns
Date: 2014-06-24 16:57:53
Message-ID: CAHyXU0zKHCX-onc-hULCtE9gx=xkB3d7DjNki5_DeHtAhKP=Bg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Tue, Jun 24, 2014 at 9:08 AM, Andrew Dunstan <andrew(at)dunslane(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2014-06-24 20:11:45 Re: pg_upgrade < 9.3 -> >=9.3 misses a step around multixacts
Previous Message Andres Freund 2014-06-24 15:15:25 Re: BUG #10748: xmax is not resetting properly with FOR UPDATE

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2014-06-24 16:58:08 Re: idle_in_transaction_timeout
Previous Message Pavel Stehule 2014-06-24 16:53:08 Re: idle_in_transaction_timeout