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

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #11207: empty path will segfault jsonb #>
Date: 2014-08-20 01:18:38
Message-ID: 1408497518662-5815490.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2014-08-20 01:19:36 Re: BUG #11207: empty path will segfault jsonb #>
Previous Message Tom Lane 2014-08-19 22:25:32 Re: BUG #11207: empty path will segfault jsonb #>