Re: Further issues with jsonb semantics, documentation - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: Further issues with jsonb semantics, documentation
Date
Msg-id CAM3SWZRZ=FaBn8GV1radGxcdcUtSAnJ6ftmkDEB0Gei-4bdriQ@mail.gmail.com
Whole thread Raw
In response to Re: Further issues with jsonb semantics, documentation  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
On Fri, Jun 5, 2015 at 1:05 PM, Andrew Dunstan <andrew@dunslane.net> wrote:
> So probably the least invasive change would be to rename the text[] variant
> operator to something like "#-" and rename the corresponding function to
> jsonb_delete_path.
>
> We could also decide not to keep an operator at all, on the ground that we
> think we'll implement a type that encapsulates json pointer in 9.6, and just
> keep the renamed function.

Obviously I prefer the latter option, but the former is still an
improvement. To repeat myself, ambiguities around operators are not
the only problem: It seems no good to me that there is no way to
accomplish an equivalent outcome to that shown below with the
similarly-spelled operator you talk about (that is, the operator
currently spelled "operator jsonb - text[]"):

postgres=# select '["a", "c", "a"]'::jsonb - 'a';?column?
----------["c"]
(1 row)

With the operator currently spelled "operator jsonb - text[]", at the
very least you have to do this instead:

postgres=# select '["a", "c", "a"]'::jsonb - '{0}'::text[] - '{1}'::text[];?column?
----------["c"]
(1 row)

If nothing else, these operators are too dissimilar for overloading to
be helpful.
-- 
Peter Geoghegan



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [GENERAL] 9.4.1 -> 9.4.2 problem: could not access status of transaction 1
Next
From: Thomas Munro
Date:
Subject: Re: could not truncate directory "pg_subtrans": apparent wraparound