On Tue, Jun 10, 2025 at 4:52 PM Mark Dake wrote:
> Happy to clarify further or contribute a patch.
On Thu, Jun 12, 2025 at 9:23 AM Mark Drake wrote:
> Sorry, not a 'C' coder. A man must know his limits. ☹
Uh ... what?
--
Robert Haas
EDB: http://www.enterprisedb.com
Sorry, not a 'C' coder. A man must know his limits. ☹
-Original Message-
From: David E. Wheeler
Sent: Wednesday, June 11, 2025 11:49 AM
To: Mark Dake
Cc: pgsql-hack...@postgresql.org
Subject: Re: Inconsistent Behavior in JSONB Numeric Array Deletion
On Jun 7, 2025, at 16:20,
Cc: Robert Haas ; Mark Dake
; pgsql-hack...@postgresql.org
Subject: Re: Inconsistent Behavior in JSONB Numeric Array Deletion
On Jun 11, 2025, at 17:43, Tom Lane wrote:
> I fear that that would cause some problems. Consider
>
> regression=# select '["foo"
On Jun 11, 2025, at 17:43, Tom Lane wrote:
> I fear that that would cause some problems. Consider
>
> regression=# select '["foo", "bar"]'::jsonb - 'bar';
> ?column?
> --
> ["foo"]
> (1 row)
>
> Right now we resolve the unlabeled literal as type text.
> But if jsonb - jsonb existed, w
"David E. Wheeler" writes:
> Bear in mind that `-` currently does both. Of the three current variants, the
> first two delete from an array by value:
> * jsonb - text: Deletes a key (and its value) from a JSON object, or matching
> string value(s) from a JSON array.
> * jsonb - text[] → jsonb:
On Jun 11, 2025, at 16:03, Robert Haas wrote:
> The proposed behavior of the operator you want to add would be
> inconsistent with the existing integer subtraction operator, because
> the former would remove by value and the latter removes by index.
Bear in mind that `-` currently does both. Of
On Tue, Jun 10, 2025 at 4:52 PM Mark Dake wrote:
> SELECT jsonb('[2,3,1]') @> to_jsonb(1);
> -- Returns true
>
> However, when attempting to remove that value from the array using -, the
> operation fails:
> SELECT jsonb('[2,3,1]') - to_jsonb(1);
> -- ERROR: operator does not exist: jsonb - jsonb
On Jun 7, 2025, at 16:20, Mark Dake wrote:
> Support a jsonb - jsonb operator where, if the RHS is a scalar that appears
> in the LHS array, the operator removes all matching values:
> SELECT jsonb('[2,3,1]') - to_jsonb(1);
> -- Expected: [2, 3]
> This would mirror similar behavior in many appli
Hi all,
I'd like to report what I believe is an inconsistency in the behavior of the
jsonb - operator when applied to numeric arrays.
Problem
PostgreSQL allows us to check for the presence of a scalar inside a JSONB
array:
SELECT jsonb('[2,3,1]') @> to_jsonb(1);
-- Returns true
Ho