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

From Xtra Coder
Subject Re: BUG #13937: 'src' -> jsonb_each() -> jsonb_object() -> 'dst' does not recreate 'src' as valid jsonb
Date
Msg-id CAL2enjLXVTKHvEi7cA2sqx9zjUE_qAP7xr5z7kmak1VMy-gNZA@mail.gmail.com
Whole thread Raw
In response to Re: BUG #13937: 'src' -> jsonb_each() -> jsonb_object() -> 'dst' does not recreate 'src' as valid jsonb  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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>*.

pgsql-bugs by date:

Previous
From: Xtra Coder
Date:
Subject: Re: BUG #13937: 'src' -> jsonb_each() -> jsonb_object() -> 'dst' does not recreate 'src' as valid jsonb
Next
From: gsv371@ukr.net
Date:
Subject: BUG #13941: Different value "pg_constraint.consrc" for similar Check Constrait