pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #14080: JSONB order changes when using json_pretty()
2+ messages / 2 participants
[nested] [flat]

* BUG #14080: JSONB order changes when using json_pretty()
@ 2016-04-08 22:43 jack@fastly.com
  2016-04-10 15:54 ` Re: BUG #14080: JSONB order changes when using json_pretty() David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: jack@fastly.com @ 2016-04-08 22:43 UTC (permalink / raw)
  To: pgsql-bugs

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;
```



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #14080: JSONB order changes when using json_pretty()
  2016-04-08 22:43 BUG #14080: JSONB order changes when using json_pretty() jack@fastly.com
@ 2016-04-10 15:54 ` David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: David G. Johnston @ 2016-04-10 15:54 UTC (permalink / raw)
  To: jack@fastly.com; +Cc: 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 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;
> ```
>

​Your subject line and message do not seem to match each other.

WRT the subject line, jsonb documentation states:

> ​jsonb 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.

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-04-10 15:54 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-04-08 22:43 BUG #14080: JSONB order changes when using json_pretty() jack@fastly.com
2016-04-10 15:54 ` David G. Johnston <david.g.johnston@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox