Re: BUG #11207: empty path will segfault jsonb #> - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #11207: empty path will segfault jsonb #>
Date
Msg-id 28953.1408589417@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #11207: empty path will segfault jsonb #>  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: BUG #11207: empty path will segfault jsonb #>
Re: BUG #11207: empty path will segfault jsonb #>
Re: BUG #11207: empty path will segfault jsonb #>
List pgsql-bugs
Andrew Dunstan <andrew@dunslane.net> writes:
> On 08/20/2014 07:30 PM, Tom Lane wrote:
>> 1. #> now returns the input object if the RHS array is empty;

> So will
>      val #>> '{}'
> now return a dequoted bare scalar string? I think that's where the OP
> actually came into this.

Hm ... as the patch stands, you get the same thing from either operator:

regression=# select '"foo"'::json #> '{}';
 ?column?
----------
 "foo"
(1 row)

regression=# select '"foo"'::json #>> '{}';
 ?column?
----------
 "foo"
(1 row)

If you think the latter should be dequoted, we can probably make it so.
I'm not entirely convinced that's right though: you could argue that
dequoting is a function of the -> operator and we applied zero such
operators.  (I'm not wedded to that argument, just raising it as food
for thought.)  Comments?

            regards, tom lane

pgsql-bugs by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: BUG #11207: empty path will segfault jsonb #>
Next
From: David G Johnston
Date:
Subject: Re: BUG #11207: empty path will segfault jsonb #>