Re: jsonb_set() strictness considered harmful to data

From: Christoph Moench-Tegeder <cmt(at)burggraben(dot)net>
To: Ariadne Conill <ariadne(at)dereferenced(dot)org>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org, feld(at)freebsd(dot)org
Subject: Re: jsonb_set() strictness considered harmful to data
Date: 2019-10-18 22:57:52
Message-ID: 20191018225752.GC56427@elch.exwg.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

## Ariadne Conill (ariadne(at)dereferenced(dot)org):

> Why don't we fix the database engine to not eat data when the
> jsonb_set() operation fails?

It didn't fail, it worked like SQL (you've been doing SQL for too
long when you get used to the NULL propagation, but that's still
what SQL does - check "+" for example).
And changing a function will cause fun for everyone who relies on
the current behaviour - so at least it shouldn't be done on a whim
(some might argue that a whim was what got us into this situation
in the first place).

Continuing along that thought, I'd even argue that your are
writing code which relies on properties of the data which you never
guaranteed. There is a use case for data types and constraints.
Not that I'm arguing for maximum surprise in programming, but
I'm a little puzzled when people eschew thew built-in tools and
start implmenting them again side-to-side with what's already
there.

Regards,
Christoph

--
Spare Space

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2019-10-18 23:01:43 Re: jsonb_set() strictness considered harmful to data
Previous Message Ariadne Conill 2019-10-18 22:11:51 Re: jsonb_set() strictness considered harmful to data

Browse pgsql-hackers by date

  From Date Subject
Next Message Adrian Klaver 2019-10-18 23:01:43 Re: jsonb_set() strictness considered harmful to data
Previous Message Ariadne Conill 2019-10-18 22:11:51 Re: jsonb_set() strictness considered harmful to data