Re: Inconsistent Behavior in JSONB Numeric Array Deletion

Поиск
Список
Период
Сортировка
От David E. Wheeler
Тема Re: Inconsistent Behavior in JSONB Numeric Array Deletion
Дата
Msg-id E66B60CD-6562-4AF0-BD60-B4D5560B06B4@justatheory.com
обсуждение исходный текст
Ответ на Re: Inconsistent Behavior in JSONB Numeric Array Deletion  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы RE: Inconsistent Behavior in JSONB Numeric Array Deletion
Список pgsql-hackers
On Jun 11, 2025, at 17:43, Tom Lane <tgl@sss.pgh.pa.us> 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, we'd decide it's jsonb, thanks
> to the heuristic that prefers same-type-as-the-other-input
> (rule 2a at [1]).  So it's pretty nearly certain that
> adding jsonb - jsonb would break some existing queries;
> or worse, silently cause them to do something different.
> Maybe that's acceptable, but it's a demerit of this proposal.

Ah. It’s a pity the existing operator behaves differently for different rhs operands. But maybe add a new one that’s
definedto operator on contents rather than keys/indexes and deprecate (or un-document) the content behavior in the `-`
operator?

Best,

David


Вложения

В списке pgsql-hackers по дате отправления: