Re: jsonb_set() strictness considered harmful to data
От
Abelard Hoffman
Тема
Re: jsonb_set() strictness considered harmful to data
Дата
Msg-id
CACEJHMjkOOSKw=4sG0EexjnG8RaBsO0qPfPF4FAujpGrVRgCgA@mail.gmail.com
Список
Дерево обсуждения
jsonb_set() strictness considered harmful to data Ariadne Conill <ariadne@dereferenced.org>
Re: jsonb_set() strictness considered harmful to data Christoph Moench-Tegeder <cmt@burggraben.net>
Re: jsonb_set() strictness considered harmful to data Ariadne Conill <ariadne@dereferenced.org>
Re: jsonb_set() strictness considered harmful to data Christoph Moench-Tegeder <cmt@burggraben.net>
Re: jsonb_set() strictness considered harmful to data Ariadne Conill <ariadne@dereferenced.org>
Re: jsonb_set() strictness considered harmful to data Stephen Frost <sfrost@snowman.net>
Re: jsonb_set() strictness considered harmful to data Christoph Moench-Tegeder <cmt@burggraben.net>
Re: jsonb_set() strictness considered harmful to data "David G. Johnston" <david.g.johnston@gmail.com>
Re: jsonb_set() strictness considered harmful to data Ariadne Conill <ariadne@dereferenced.org>
Re: jsonb_set() strictness considered harmful to data Adrian Klaver <adrian.klaver@aklaver.com>
Re: jsonb_set() strictness considered harmful to data Ariadne Conill <ariadne@dereferenced.org>
Re: jsonb_set() strictness considered harmful to data Stephen Frost <sfrost@snowman.net>
Re: jsonb_set() strictness considered harmful to data Ariadne Conill <ariadne@dereferenced.org>
Re: jsonb_set() strictness considered harmful to data Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: jsonb_set() strictness considered harmful to data Dmitry Dolgov <9erthalion6@gmail.com>
Re: jsonb_set() strictness considered harmful to data Stephen Frost <sfrost@snowman.net>
Re: jsonb_set() strictness considered harmful to data Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: jsonb_set() strictness considered harmful to data Adrian Klaver <adrian.klaver@aklaver.com>
Re: jsonb_set() strictness considered harmful to data Ariadne Conill <ariadne@dereferenced.org>
Re: jsonb_set() strictness considered harmful to data Adrian Klaver <adrian.klaver@aklaver.com>
Re: jsonb_set() strictness considered harmful to data Laurenz Albe <laurenz.albe@cybertec.at>
Re: jsonb_set() strictness considered harmful to data Paul A Jungwirth <pj@illuminatedcomputing.com>
Re: jsonb_set() strictness considered harmful to data Pavel Stehule <pavel.stehule@gmail.com>
Re: jsonb_set() strictness considered harmful to data "David G. Johnston" <david.g.johnston@gmail.com>
Re: jsonb_set() strictness considered harmful to data Pavel Stehule <pavel.stehule@gmail.com>
Re: jsonb_set() strictness considered harmful to data Ariadne Conill <ariadne@dereferenced.org>
Re: jsonb_set() strictness considered harmful to data Steve Atkins <steve@blighty.com>
Re: jsonb_set() strictness considered harmful to data "Mark Felder" <feld@FreeBSD.org>
Re: jsonb_set() strictness considered harmful to data Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: jsonb_set() strictness considered harmful to data Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: jsonb_set() strictness considered harmful to data Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: jsonb_set() strictness considered harmful to data "David G. Johnston" <david.g.johnston@gmail.com>
Re: jsonb_set() strictness considered harmful to data Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: jsonb_set() strictness considered harmful to data Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: jsonb_set() strictness considered harmful to data Ariadne Conill <ariadne@dereferenced.org>
jsonb_set() strictness considered harmful to data Floris Van Nee <florisvannee@Optiver.com>
Re: jsonb_set() strictness considered harmful to data Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: jsonb_set() strictness considered harmful to data "David G. Johnston" <david.g.johnston@gmail.com>
Re: jsonb_set() strictness considered harmful to data Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: jsonb_set() strictness considered harmful to data Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: jsonb_set() strictness considered harmful to data Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: jsonb_set() strictness considered harmful to data Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: jsonb_set() strictness considered harmful to data Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: jsonb_set() strictness considered harmful to data Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: jsonb_set() strictness considered harmful to data "Mark Felder" <feld@FreeBSD.org>
Re: jsonb_set() strictness considered harmful to data Pavel Stehule <pavel.stehule@gmail.com>
Re: jsonb_set() strictness considered harmful to data Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: jsonb_set() strictness considered harmful to data Pavel Stehule <pavel.stehule@gmail.com>
Re: jsonb_set() strictness considered harmful to data Michael Paquier <michael@paquier.xyz>
Re: jsonb_set() strictness considered harmful to data Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: jsonb_set() strictness considered harmful to data Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: jsonb_set() strictness considered harmful to data Pavel Stehule <pavel.stehule@gmail.com>
Re: jsonb_set() strictness considered harmful to data Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: jsonb_set() strictness considered harmful to data Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: jsonb_set() strictness considered harmful to data "Ariadne Conill" <ariadne@dereferenced.org>
Re: jsonb_set() strictness considered harmful to data Rob Sargent <robjsargent@gmail.com>
Re: jsonb_set() strictness considered harmful to data Adrian Klaver <adrian.klaver@aklaver.com>
Re: jsonb_set() strictness considered harmful to data Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: jsonb_set() strictness considered harmful to data Adrian Klaver <adrian.klaver@aklaver.com>
Re: jsonb_set() strictness considered harmful to data rob stone <floriparob@gmail.com>
Re: jsonb_set() strictness considered harmful to data "David G. Johnston" <david.g.johnston@gmail.com>
Re: jsonb_set() strictness considered harmful to data Steven Pousty <steve.pousty@gmail.com>
Re: jsonb_set() strictness considered harmful to data raf <raf@raf.org>
Re: jsonb_set() strictness considered harmful to data Steven Pousty <steve.pousty@gmail.com>
Re: jsonb_set() strictness considered harmful to data raf <raf@raf.org>
Re: jsonb_set() strictness considered harmful to data "Peter J. Holzer" <hjp-pgsql@hjp.at>
Re: jsonb_set() strictness considered harmful to data "Peter J. Holzer" <hjp-pgsql@hjp.at>
Re: jsonb_set() strictness considered harmful to data Steve Atkins <steve@blighty.com>
Re: jsonb_set() strictness considered harmful to data "Peter J. Holzer" <hjp-pgsql@hjp.at>
Re: jsonb_set() strictness considered harmful to data "David G. Johnston" <david.g.johnston@gmail.com>
Re: jsonb_set() strictness considered harmful to data "Peter J. Holzer" <hjp-pgsql@hjp.at>
Re: jsonb_set() strictness considered harmful to data rob stone <floriparob@gmail.com>
Re: jsonb_set() strictness considered harmful to data Laurenz Albe <laurenz.albe@cybertec.at>
Re: jsonb_set() strictness considered harmful to data Stuart McGraw <smcg4191@mtneva.com>
Re: jsonb_set() strictness considered harmful to data Laurenz Albe <laurenz.albe@cybertec.at>
Re: jsonb_set() strictness considered harmful to data Tom Lane <tgl@sss.pgh.pa.us>
Re: jsonb_set() strictness considered harmful to data Stuart McGraw <smcg4191@mtneva.com>
Re: jsonb_set() strictness considered harmful to data Maurice Aubrey <maurice.aubrey@gmail.com>
Re: jsonb_set() strictness considered harmful to data Maciek Sakrejda <m.sakrejda@gmail.com>
Re: jsonb_set() strictness considered harmful to data "David G. Johnston" <david.g.johnston@gmail.com>
Re: jsonb_set() strictness considered harmful to data Isaac Morland <isaac.morland@gmail.com>
I would argue that only if the target parameter (the actual json value) is NULL should the result be NULL. The function is documented as returning the target, with modifications to a small part of its structure as specified by the other parameters. It is strange for the result to suddenly collapse down to NULL just because another parameter is NULL. Perhaps if the path is NULL, that can mean "don't update". And if create_missing is NULL, that should mean the same as not specifying it. I think. At a minimum, if we don't change it, the documentation needs to get one of those warning boxes alerting people that the functions will destroy their input entirely rather than slightly modifying it if any of the other parameters are NULL.My only doubt about any of this is that by the same argument, functions like replace() should not return NULL if the 2nd or 3rd parameter is NULL. I'm guessing replace() is specified by SQL and also unchanged in many versions so therefore not eligible for re-thinking but it still gives me just a bit of pause.
That's the essential difference though, no? With jsonb, conceptually, we have a nested row. That's where we get confused. We think that the operation should affect the element within the nested structure, not the structure itself.
It would be equivalent to replace() nulling out the entire row on null.
I understand the logic behind it, but I also definitely see why it's not intuitive.
AH
В списке pgsql-general по дате отправления