Re: BUG #14080: JSONB order changes when using json_pretty() - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: BUG #14080: JSONB order changes when using json_pretty()
Date
Msg-id CAKFQuwa6b076timjCWTGeO4goM5v1Mrjhw0LZ9EPk3=6UL2vVA@mail.gmail.com
Whole thread Raw
In response to BUG #14080: JSONB order changes when using json_pretty()  (jack@fastly.com)
List pgsql-bugs
On Fri, Apr 8, 2016 at 3:43 PM, <jack@fastly.com> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      14080
> Logged by:          Jack
> Email address:      jack@fastly.com
> PostgreSQL version: 9.5.2
> Operating system:   Mac OSX
> Description:
>
> while looking though datasets I noticed json_pretty is retuning a differe=
nt
> record.
>
> This query will return an id that I expect and other defendant queries se=
em
> to work
> ```
> select jsonb_array_elements(details->'version'->'domains'), id from
> services
> order by id limit 1 offset 400;
> ```
>
> This query returns a random record both the id and the json are valid the=
y
> are just the wrong one.
>
> ```
> select jsonb_pretty(details->'version'->'domains'), id from services orde=
r
> by id limit 1 offset 400;
> ```
>

=E2=80=8BYour subject line and message do not seem to match each other.

WRT the subject line, jsonb documentation states:

> =E2=80=8Bjsonb does not preserve white space, does not preserve the order=
 of
object keys, and does not keep duplicate object keys.

So there isn't a bug there.

Without a self-contained example for the message body I'm inclined to
suspect user-error/mis-understanding.  Please provide something that
someone else can run to see the misbehavior.

David J.

pgsql-bugs by date:

Previous
From: cgh_chen@126.com
Date:
Subject: BUG #14081: System LC_COLLATE changed
Next
From: "David G. Johnston"
Date:
Subject: Re: BUG #14079: Issues with query