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

From David G Johnston
Subject Re: BUG #11207: empty path will segfault jsonb #>
Date
Msg-id 1408497518662-5815490.post@n5.nabble.com
Whole thread Raw
In response to Re: BUG #11207: empty path will segfault jsonb #>  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #11207: empty path will segfault jsonb #>
List pgsql-bugs
Tom Lane-2 wrote
> justin.vanwinkle@

>  writes:
>> select '{"a": {"b":{"c": "foo"}}}'::jsonb #> '{}';
>> [ dumps core ]
>
> Hm.  It's not immediately obvious to me what this should be defined to do;
> should it throw an error, or return the complete LHS object, or perhaps
> return a NULL?  But the author of get_jsonb_path_all() evidently didn't
> consider the case.
>
> Easy enough to fix once we settle on a definition.

As there is no immediately obvious way to return the entire LHS when using
this operator it doesn't seem that far-fetched to define this as the syntax
that would do so - though then there wouldn't be a way to not return the
entire LHS without providing a known invalid key (maybe '{NULL}' - what
would that do now anyway...)

Not that we would necessarily want to duplicate hstore but "hstore ->
text[]" seems similar enough to emulate if desired.

David J.




--
View this message in context:
http://postgresql.1045698.n5.nabble.com/BUG-11207-empty-path-will-segfault-jsonb-tp5815469p5815490.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #11207: empty path will segfault jsonb #>
Next
From: Tom Lane
Date:
Subject: Re: BUG #11207: empty path will segfault jsonb #>