Re: Further issues with jsonb semantics, documentation
От | Peter Geoghegan |
---|---|
Тема | Re: Further issues with jsonb semantics, documentation |
Дата | |
Msg-id | CAM3SWZRL3uu0NtfNCia5F0hQfxzZ5BtejCkv4Ygs-GctkDk=+g@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Further issues with jsonb semantics, documentation (Alvaro Herrera <alvherre@2ndquadrant.com>) |
Ответы |
Re: Further issues with jsonb semantics, documentation
|
Список | pgsql-hackers |
On Thu, Jun 4, 2015 at 12:16 PM, Alvaro Herrera <alvherre@2ndquadrant.com> wrote: > I'm just skimming here, but if a jsonb_path type is being proposed, > perhaps it would be better not to have operators that take text or > text[] as second argument. We can provide that functionality with just > functions. For example, it will be confusing to have > > jsonb 'some json value' - '{foo,bar}' > > operate too differently from > > jsonb 'some json value' - json_path '{foo,bar}' > > And it will be a nasty regression to have 9.5 allow > jsonb 'some json value' - '{foo,bar}' > and then have 9.6 error out with "ambiguous operator" when the json_path > thing is added. Fair point, but FWIW I don't think it'll end up being a new type like json_path -- it'll just be jsonb, as with containment. I can see there being an operator that performs deletion in a very similar way to how "operator jsonb @> jsonb" performs containment (recall that jsonb containment is a very JSON-ish flavor of containment). I would like these new-to-9.5 deletion operators to work at the top level only, like "operator jsonb ? text" and "operator jsonb ?| text", sharing their idea of a key, __including that string array elements are keys__. We haven't got a containment-style nested delete operator for 9.5, but we can hope for it in the future. In the meantime, you get much of the benefit of that with jsonb_delete(), which *can* support nested deletion. It does so by buying into the "operator jsonb ? text" idea of a key (including that string array elements are keys), although with a twist: the paths text[] right operand operates at multiple nesting levels (not supporting traversing arrays, as Andrew implemented it, but OTOH adding support for deleting String array elements based on the string alone, useful for "tag" arrays). If in 9.6 we have something like an "operator jsonb @- jsonb" operator for containment style deletion, and a 9.5 era "operator jsonb - text" and operator jsonb - text[]" pair of operators for existence style deletion (matching "operator jsonb ? text", operating only on the top level), that will be pretty good. The fact that jsonb_delete() will have somewhat bridged the gap nesting-deletion-wise for 9.5 (without being usable through an operator) won't really matter then. I want to keep the "twist" I described out of any jsonb operators that are shipped, and only use it within functions. -- Peter Geoghegan
В списке pgsql-hackers по дате отправления: