Re: jsonb_set: update or upsert default?

Поиск
Список
Период
Сортировка
От David E. Wheeler
Тема Re: jsonb_set: update or upsert default?
Дата
Msg-id B3D315A2-5553-49F5-AA47-9F57DA6BBE1F@justatheory.com
обсуждение исходный текст
Ответ на jsonb_set: update or upsert default?  (Andrew Dunstan <andrew@dunslane.net>)
Ответы Re: jsonb_set: update or upsert default?  (Petr Jelinek <petr@2ndquadrant.com>)
Список pgsql-hackers
On May 22, 2015, at 7:22 PM, Andrew Dunstan <andrew@dunslane.net> wrote:

> The proposed flag for jsonb_set (the renamed jsonb_replace) in the patch I recently published is set to false,
meaningthat the default behaviour is to require all elements of the path including the last to be present. What that
doesis effectively UPDATE for jsonb. If the flag is true, then the last element can be absent, in which case it's
created,so this is basically UPSERT for jsonb. The question is which should be the default. We got into the weeds on
thiswith suggestions of throwing errors on missing paths, but that's going nowhere, and I want to get discussion back
ontothe topic of what should be the default. 

Here’s JavaScript in Chrome, FWIW:

var f = {}
f["foo"][0] = “bar"
Uncaught TypeError: Cannot set property '0' of undefined   at <anonymous>:2:13   at Object.InjectedScript._evaluateOn
(<anonymous>:895:140)  at Object.InjectedScript._evaluateAndWrap (<anonymous>:828:34)   at
Object.InjectedScript.evaluate(<anonymous>:694:21) 

Best,

David


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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: Re: [COMMITTERS] pgsql: Map basebackup tablespaces using a tablespace_map file
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Run pgindent now?