Re: jsonb_set() strictness considered harmful to data

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>
Cc: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Floris Van Nee <florisvannee(at)optiver(dot)com>, Ariadne Conill <ariadne(at)dereferenced(dot)org>, Mark Felder <feld(at)freebsd(dot)org>, "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 15:40:44
Message-ID: CAKFQuwYp1b4jU294Q1tRbib3Ei9WRYBiKvGQ+ySnspSJkgdZhw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Sun, Oct 20, 2019 at 3:51 PM Andrew Dunstan <
andrew(dot)dunstan(at)2ndquadrant(dot)com> wrote:

> I'm not arguing against the idea of improving the situation. But I am
> arguing against a minimal fix that will not provide much of value to a
> careful app developer. i.e. I want to do more to support app devs.
> Ideally they would not need to use wrapper functions. There will be
> plenty of situations where it is mighty inconvenient to catch an
> exception thrown by jsonb_set(). And catching exceptions can be
> expensive. You want to avoid that if possible in your
> performance-critical plpgsql code.
>

As there is pretty much nothing that can be done at runtime if this
exception is raised actually "catching" it anywhere deeper than near the
top of the application code is largely pointless. Its more like a
NullPointerException in Java - if the application raises it there should be
a last line of defense error handler that basically says "you developer
made a mistake somewhere and needs to fix it - tell them this happened".

Performance critical subsections (and pretty much the whole) of the
application can just raise the error to the caller using normal mechanisms
for "SQLException" propogation.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steven Pousty 2019-10-21 16:39:13 Re: jsonb_set() strictness considered harmful to data
Previous Message Horacio Miranda 2019-10-21 15:35:40 Re: Postgres Point in time Recovery (PITR),

Browse pgsql-hackers by date

  From Date Subject
Next Message Chapman Flack 2019-10-21 15:46:43 Re: Proposal: Make use of C99 designated initialisers for nulls/values arrays
Previous Message Joe Nelson 2019-10-21 15:25:57 Re: Proposal: Make use of C99 designated initialisers for nulls/values arrays