Re: BUG #13937: 'src' -> jsonb_each() -> jsonb_object() -> 'dst' does not recreate 'src' as valid jsonb

From: Xtra Coder <xtracoder(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #13937: 'src' -> jsonb_each() -> jsonb_object() -> 'dst' does not recreate 'src' as valid jsonb
Date: 2016-02-09 18:42:15
Message-ID: CAL2enjLXVTKHvEi7cA2sqx9zjUE_qAP7xr5z7kmak1VMy-gNZA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Re: I don't think this is a bug at all ...
------------------------------------------------------

I would not agree. This issue can be treated as a bug from
various perspective, and I just can't tell which perspective should be
treated as bug. For example:

Bug in implementation of jsonb_object(keys text[], values text[]) method
....

... since it is 'jsonb' method - regular user would expect that values are
converted to 'jsonb' just like in other cases of 'string' ->
'jsonb' conversion, but in this cases it is treated just like string.

Bug in documentation
http://www.postgresql.org/docs/current/static/functions-json.html ...

... which may potentially need to explicitly say - "values are treated as
plain strings, with no attempt to convert to jsonb. For other use-cases -
use ...".

Bug in design/architecture ...

... current behavior is by design and method which accepts 'values' as '
jsonb[]' is missing for some reason (and this efficiently means there is no
'normal' way to construct jsonb object).

So ... it is up to someone from PostgreSQL dev team to decide what is bug
and what is not bug here. If above mentioned 'jsonb_object_agg' method is
actually intended for such use-case - then probably yes, the only bug is in
documentation - it is really hardly possible to get to 'jsonb_object_agg'
while reading section ''JSON Creation Functions" at
*http://www.postgresql.org/docs/current/static/functions-json.html
<http://www.postgresql.org/docs/current/static/functions-json.html>*.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Xtra Coder 2016-02-09 18:45:03 Re: BUG #13937: 'src' -> jsonb_each() -> jsonb_object() -> 'dst' does not recreate 'src' as valid jsonb
Previous Message Tom Lane 2016-02-09 17:15:54 Re: BUG #13938: CAST error on Index "function must be immutable"