pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #13506: jsonb || operator does not work
3+ messages / 3 participants
[nested] [flat]

* BUG #13506: jsonb || operator does not work
@ 2015-07-20 15:58  gregoire.hubert@pragmafabrik.com
  0 siblings, 1 reply; 3+ messages in thread

From: gregoire.hubert@pragmafabrik.com @ 2015-07-20 15:58 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      13506
Logged by:          Grégoire HUBERT
Email address:      gregoire.hubert@pragmafabrik.com
PostgreSQL version: 9.5alpha1
Operating system:   debian jessie
Description:        

select val->'a'||val->'c' from (values ($j${"a": {"b": 2}, "c": {"d":
3}}$j$::jsonb)) a (val);
┌──────────┐
│ ?column? │
├──────────┤
│ {"d": 3} │
└──────────┘
(1 row)

I think this should return '{"b": 2, "d": 3}'


-- 
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] 3+ messages in thread

* Re: BUG #13506: jsonb || operator does not work
@ 2015-07-20 17:44  Tom Lane <tgl@sss.pgh.pa.us>
  parent: gregoire.hubert@pragmafabrik.com
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2015-07-20 17:44 UTC (permalink / raw)
  To: gregoire.hubert@pragmafabrik.com; +Cc: pgsql-bugs

gregoire.hubert@pragmafabrik.com writes:
> select val->'a'||val->'c' from (values ($j${"a": {"b": 2}, "c": {"d":
> 3}}$j$::jsonb)) a (val);

You're making unwarranted assumptions about the precedence of those
operators.

(val->'a')||(val->'c') does what you expect.  Working out what the
expression does as-written is left as an exercise for the reader.

			regards, tom lane


-- 
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] 3+ messages in thread

* Re: BUG #13506: jsonb || operator does not work
@ 2015-07-21 09:06  grégoire Hubert <gregoire.hubert@pragmafabrik.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: grégoire Hubert @ 2015-07-21 09:06 UTC (permalink / raw)
  To: pgsql-bugs

On Mon, Jul 20, 2015 at 7:44 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> gregoire.hubert@pragmafabrik.com writes:
>> select val->'a'||val->'c' from (values ($j${"a": {"b": 2}, "c": {"d":
>> 3}}$j$::jsonb)) a (val);
>
> You're making unwarranted assumptions about the precedence of those
> operators.
>
> (val->'a')||(val->'c') does what you expect.  Working out what the
> expression does as-written is left as an exercise for the reader.


Ok, I got it: select (val->'a')||(val->'c') from…

Thank you for taking the time to reply.

Regards,
-- 
Grégoire HUBERT
Tel: 06.60.15.49.80
PragmaFabrik
http://www.pragmafabrik.com


-- 
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] 3+ messages in thread


end of thread, other threads:[~2015-07-21 09:06 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-07-20 15:58 BUG #13506: jsonb || operator does not work gregoire.hubert@pragmafabrik.com
2015-07-20 17:44 ` Tom Lane <tgl@sss.pgh.pa.us>
2015-07-21 09:06   ` grégoire Hubert <gregoire.hubert@pragmafabrik.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