Re: Add json_object(text[], json[])? - Mailing list pgsql-hackers

From Paul A Jungwirth
Subject Re: Add json_object(text[], json[])?
Date
Msg-id CA+renyU3LHWw8NW40nzcB=i4KVRqrjPoJVdB7Rvi-z839wCo-g@mail.gmail.com
Whole thread Raw
In response to Re: Add json_object(text[], json[])?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Add json_object(text[], json[])?
List pgsql-hackers
On Thu, Oct 24, 2019 at 8:52 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I think a potential problem is creation of ambiguity where there was
> none before.

I agree that's not nice, and it seems like a new name might be better.

> Also, as the prototype implementation shows, it's not like you
> can't get this functionality today ... you just need to cast
> jsonb to text.  Admittedly that's annoying and wasteful.

I don't think that gives the same result, does it? For example:

# select jsonb_object(array['foo'], array['[{"bar-bar": ["baz"]}]'::jsonb]);
             jsonb_object
---------------------------------------
 {"foo": "[{\"bar-bar\": [\"baz\"]}]"}

You can see the values are JSON strings, not JSON arrays/objects/etc.

Regards,
Paul



pgsql-hackers by date:

Previous
From: Victor Spirin
Date:
Subject: psql tab-complete
Next
From: Paul A Jungwirth
Date:
Subject: Re: Add json_object(text[], json[])?