From: | raf <raf(at)raf(dot)org> |
---|---|
To: | "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: jsonb_set() strictness considered harmful to data |
Date: | 2019-10-21 22:16:05 |
Message-ID: | 20191021221605.qrdthyxzmjxwm3r3@raf.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
Steven Pousty wrote:
> On Sun, Oct 20, 2019 at 4:31 PM raf <raf(at)raf(dot)org> wrote:
>
> > Steven Pousty wrote:
> >
> > > I would think though that raising an exception is better than a
> > > default behavior which deletes data.
> >
> > I can't help but feel the need to make the point that
> > the function is not deleting anything. It is just
> > returning null. The deletion of data is being performed
> > by an update statement that uses the function's return
> > value to set a column value.
> >
> > I don't agree that raising an exception in the function
> > is a good idea (perhaps unless it's valid to assume
> > that this function will only ever be used in such a
> > context). Making the column not null (as already
> > suggested) and having the update statement itself raise
> > the exception seems more appropriate if an exception is
> > desirable. But that presumes an accurate understanding
> > of the behaviour of jsonb_set.
> >
> > Really, I think the best fix would be in the
> > documentation so that everyone who finds the function
> > in the documentation understands its behaviour
> > immediately.
> >
> Hey Raf
>
> In a perfect world I would agree with you. But often users do not read ALL
> the documentation before they use the function in their code OR they are
> not sure that the condition applies to them (until it does).
I'm well aware of that, hence the statement that this
information needs to appear at the place in the
documentation where the user is first going to
encounter the function (i.e. in the table where its
examples are). Even putting it in a note box further
down the page might not be enough (but hopefully it
will be).
cheers,
raf
From | Date | Subject | |
---|---|---|---|
Next Message | Julie Nishimura | 2019-10-21 22:26:31 | existing dblinks |
Previous Message | Adrian Klaver | 2019-10-21 21:20:17 | Re: Calling jsonb_array_elements 4 times in the same query |
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Janes | 2019-10-22 00:20:21 | logical replication empty transactions |
Previous Message | Adrian Klaver | 2019-10-21 21:08:22 | Re: jsonb_set() strictness considered harmful to data |