| From: | Станислав Губанов <gubanovss(at)gmail(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | a bug jsonb? |
| Date: | 2018-11-22 14:58:21 |
| Message-ID: | CAHdg6a7youR9u2Mua=85qs_34jzyup1vntQSAet=6aA7M7VWNQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Hello!
I'd like to clarify, if this a bug or a feature
simple JSON
{"rootC":{},"rootB":{},"rootZ":{},"rootA":[]}
Table for data
create table test_json (json_data jsonb);
put json into table
INSERT INTO test_json (json_data) VALUES
('{"rootC":{},"rootB":{},"rootZ":{},"rootA":[]}');
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": {}}
----- console log -----
test=# create table test_json (json_data jsonb);
CREATE TABLE
test=# INSERT INTO test_json (json_data) VALUES
('{"rootC":{},"rootB":{},"rootZ":{},"rootA":[]}');
INSERT 0 1
test=# select json_data from test_json;
json_data
------------------------------------------------------
{"rootA": [], "rootB": {}, "rootC": {}, "rootZ": {}}
(1 row)
test=# drop table test_json;
DROP TABLE
--
Sincerely, Stanislav!
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Josef Šimánek | 2018-11-22 15:04:27 | Re: a bug jsonb? |
| Previous Message | Laurenz Albe | 2018-11-22 11:45:34 | Re: Invoking user of the function with SECURITY DEFINER |