From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | "mark(dot)drake(at)golden-hind(dot)com" <mark(dot)drake(at)golden-hind(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: BUG #18809: Inconsistent JSON behavoir |
Date: | 2025-02-13 06:06:38 |
Message-ID: | 3530348.1739426798@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Wednesday, February 12, 2025, PG Bug reporting form <
> noreply(at)postgresql(dot)org> wrote:
>> broadway=# select jsonb('[2,3,1]') - to_jsonb(1);
>> ERROR: operator does not exist: jsonb - jsonb
>> LINE 1: select jsonb('[2,3,1]') - to_jsonb(1);
> This would be a feature request, not a bug report.
Indeed. We have these cases today:
postgres=# \do -
List of operators
Schema | Name | Left arg type | Right arg type | Result type | Description
------------+------+-----------------------------+-----------------------------+-----------------------------+-------------------------------------
...
pg_catalog | - | jsonb | integer | jsonb | delete array element
pg_catalog | - | jsonb | text | jsonb | delete object field
pg_catalog | - | jsonb | text[] | jsonb | delete object fields
...
These are already less than consistent, for example this is allowed:
postgres=# select jsonb('[2,3,1]') - 'foo'::text;
?column?
-----------
[2, 3, 1]
(1 row)
but this not so much:
postgres=# select jsonb('{"a": 1, "b": 2}') - 1;
ERROR: cannot delete from object using integer index
To invent jsonb - jsonb, you'd need to define its behavior for
every possible JSON structure on each side. I foresee plenty of
bikeshedding.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tender Wang | 2025-02-13 07:25:43 | Re: BUG #18806: When enable_rartitionwise_join is set to ON, the database shuts down abnormally |
Previous Message | David G. Johnston | 2025-02-13 05:24:22 | Re: BUG #18809: Inconsistent JSON behavoir |