Re: jsonb_set() strictness considered harmful to data

Поиск
Список
Период
Сортировка
От Stephen Frost
Тема Re: jsonb_set() strictness considered harmful to data
Дата
Msg-id 20191019152125.GN6962@tamriel.snowman.net
обсуждение исходный текст
Ответ на Re: jsonb_set() strictness considered harmful to data  (Dmitry Dolgov <9erthalion6@gmail.com>)
Ответы Re: jsonb_set() strictness considered harmful to data  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Список pgsql-general
Greetings,

* Dmitry Dolgov (9erthalion6@gmail.com) wrote:
> If we want to change it, the question is where to stop? Essentially we have:
>
>     update table set data = some_func(data, some_args_with_null);
>
> where some_func happened to be jsonb_set, but could be any strict function.

I don't think it makes any sense to try and extrapolate this out to
other strict functions.  Functions should be strict when it makes sense
for them to be- in this case, it sounds like it doesn't really make
sense for jsonb_set to be strict, and that's where we stop it.

> I wonder if in this case it makes sense to think about an alternative? For
> example, there is generic type subscripting patch, that allows to update a
> jsonb in the following way:
>
>     update table set jsonb_data[key] = 'value';
>
> It doesn't look like a function, so it's not a big deal if it will handle NULL
> values differently. And at the same time one can argue, that people, who are
> not aware about this caveat with jsonb_set and NULL values, will most likely
> use it due to a bit simpler syntax (more similar to some popular programming
> languages).

This seems like an entirely independent thing ...

Thanks,

Stephen

Вложения

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

Предыдущее
От: Christoph Moench-Tegeder
Дата:
Сообщение: Re: jsonb_set() strictness considered harmful to data
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: jsonb_set() strictness considered harmful to data