Обсуждение: BUG #14080: JSONB order changes when using json_pretty()

Поиск
Список
Период
Сортировка

BUG #14080: JSONB order changes when using json_pretty()

От
jack@fastly.com
Дата:
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 different
record.

This query will return an id that I expect and other defendant queries seem
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 they
are just the wrong one.

```
select jsonb_pretty(details->'version'->'domains'), id from services order
by id limit 1 offset 400;
```

Re: BUG #14080: JSONB order changes when using json_pretty()

От
"David G. Johnston"
Дата:
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.