Search Postgresql Archives

Re: a bug jsonb?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 22, 2018 at 3:59 PM Станислав Губанов <gubanovss@xxxxxxxxx> wrote:
....
> order of key in json is changed in such query:
> SELECT json_data FROM test_json;
> expected result: {"rootC":{},"rootB":{},"rootZ":{},"rootA":[]}
> actual result: {"rootA": [], "rootB": {}, "rootC": {}, "rootZ": {}}

>From https://www.postgresql.org/docs/11/datatype-json.html

"There are two JSON data types: json and jsonb. They accept almost
identical sets of values as input. The major practical difference is
one of efficiency. The json data type stores an exact copy of the
input text, which processing functions must reparse on each execution;
while jsonb data is stored in a decomposed binary format that makes it
slightly slower to input due to added conversion overhead, but
significantly faster to process, since no reparsing is needed. jsonb
also supports indexing, which can be a significant advantage.

Because the json type stores an exact copy of the input text, it will
preserve semantically-insignificant white space between tokens, as
well as the order of keys within JSON objects. Also, if a JSON object
within the value contains the same key more than once, all the
key/value pairs are kept. (The processing functions consider the last
value as the operative one.) By contrast, jsonb does not preserve
white space, does not preserve the order of object keys, and does not
keep duplicate object keys. If duplicate keys are specified in the
input, only the last value is kept."

Francisco Olarte.





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux