Re: BUG #11207: empty path will segfault jsonb #>

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Geoghegan <pg(at)heroku(dot)com>, justin(dot)vanwinkle(at)gmail(dot)com, pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #11207: empty path will segfault jsonb #>
Date: 2014-08-21 00:50:55
Message-ID: 53F5426F.1040300@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


On 08/20/2014 07:30 PM, Tom Lane wrote:
> I wrote:
>> I think returning NULL is the right thing here, really. Aside from being
>> arguably more convenient for indexing, we will get less push-back if we
>> make some operators go from throwing errors to returning null than if
>> we make some other operators go the other way.
> Attached is a proposed patch (against HEAD and 9.4 git tip) that has
> these effects:
>
> 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.

>
> 2. Error cases in -> and #> are all removed in favor of returning NULL.
>
> The regression test changes show that we were really pretty inconsistent
> about whether to throw error or return NULL for cases where the JSON
> tree structure didn't match the extraction request. I think having a
> uniform rule is a definite improvement.
>
>

Works for me. Thans for cleaning this up.

cheers

andrew

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2014-08-21 02:50:17 Re: BUG #11207: empty path will segfault jsonb #>
Previous Message Peter Geoghegan 2014-08-20 23:39:16 Re: BUG #11207: empty path will segfault jsonb #>