Re: pgsql: Additional functions and operators for jsonb

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: pgsql: Additional functions and operators for jsonb
Дата
Msg-id 555360E0.2040004@dunslane.net
обсуждение исходный текст
Ответ на Re: pgsql: Additional functions and operators for jsonb  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: pgsql: Additional functions and operators for jsonb  (Petr Jelinek <petr@2ndquadrant.com>)
Re: pgsql: Additional functions and operators for jsonb  (Dmitry Dolgov <9erthalion6@gmail.com>)
Список pgsql-committers
On 05/12/2015 04:11 PM, Pavel Stehule wrote:
> Hi
>
> I did some tests, and I am not sure if this is not bug:
>
> postgres=# select '{"x":20}'::jsonb - 'x'::text;
> ERROR:  unknown type of jsonb container --->>> it should be empty
> jsonb, not error
> Time: 0.971 ms
> postgres=# select '{"x":20, "y":30}'::jsonb - 'x'::text;
> ┌───────────┐
> │ ?column?  │
> ╞═══════════╡
> │ {"y": 30} │
> └───────────┘
> (1 row)
>
>
>



Some of this logic needs tightening. The attached patch should do that.
Among other things, it errors out if we attempt to delete or replace on
a scalar, just returns the input argument if there are no changes
instead of cloning it, checks via an Assert that the constructed
JsonbValue is not null, and otherwise returns it unconditionally. The
result is actually simpler code, I think. Before I apply it I'd like to
have comments from Dmitry and Petr, just to make sure I haven't
inadvertently slipped my moorings.

cheers

andrew




Вложения

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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: pgsql: Fix RBM_ZERO_AND_LOCK mode to not acquire lock on local buffers.
Следующее
От: Robert Haas
Дата:
Сообщение: pgsql: Remove useless assertion.