Re: pgsql: Add a non-strict version of jsonb_set

2020-01-29 Thread Tom Lane
Michael Paquier writes: > On Wed, Jan 29, 2020 at 09:54:23AM +0100, Magnus Hagander wrote: >> We'd also have to come to this magic actual agreement on which such >> fields we *want* :) Which alone would be an improvement. > Well, there has been some discussion about this matter on the lists > no

Re: pgsql: Add a non-strict version of jsonb_set

2020-01-29 Thread Michael Paquier
On Wed, Jan 29, 2020 at 09:54:23AM +0100, Magnus Hagander wrote: > On Tue, Jan 28, 2020 at 4:36 PM Robert Haas wrote: >> Another thing that would be nice is to warn about commits that don't >> include a "Description:" line. I have been trying to be religious >> about that, but I seem to periodical

Re: pgsql: Add a non-strict version of jsonb_set

2020-01-29 Thread Magnus Hagander
On Tue, Jan 28, 2020 at 4:36 PM Robert Haas wrote: > > On Sun, Jan 19, 2020 at 7:19 PM Tom Lane wrote: > > Ah, that makes sense. Although Mark's idea of including a library > > of possible hooks somewhere under src/tools/ seems even better. > > +1. And directions for setting them up (or, as I th

Re: pgsql: Add a non-strict version of jsonb_set

2020-01-28 Thread Michael Paquier
On Tue, Jan 28, 2020 at 10:37:00AM -0500, Robert Haas wrote: > On Tue, Jan 28, 2020 at 10:36 AM Robert Haas wrote: >> Another thing that would be nice is to warn about commits that don't >> include a "Description:" line. I have been trying to be religious >> about that, but I seem to periodically

Re: pgsql: Add a non-strict version of jsonb_set

2020-01-28 Thread Robert Haas
On Tue, Jan 28, 2020 at 10:36 AM Robert Haas wrote: > Another thing that would be nice is to warn about commits that don't > include a "Description:" line. I have been trying to be religious > about that, but I seem to periodically apostatize. And of course I meant "Discussion". :-( -- Robert H

Re: pgsql: Add a non-strict version of jsonb_set

2020-01-28 Thread Robert Haas
On Sun, Jan 19, 2020 at 7:19 PM Tom Lane wrote: > Ah, that makes sense. Although Mark's idea of including a library > of possible hooks somewhere under src/tools/ seems even better. +1. And directions for setting them up (or, as I think he was proposing, a script, but directions might be better)

Re: pgsql: Add a non-strict version of jsonb_set

2020-01-19 Thread Tom Lane
Andrew Dunstan writes: > On Mon, Jan 20, 2020 at 4:16 AM Tom Lane wrote: >> I think you are right that individual committers could set up such hooks >> in their own private repos. But that's not what was being suggested, >> or so I thought. > I was really thinking of a client side hook. The rea

Re: pgsql: Add a non-strict version of jsonb_set

2020-01-19 Thread Andrew Dunstan
On Mon, Jan 20, 2020 at 4:16 AM Tom Lane wrote: > > David Fetter writes: > > On Fri, Jan 17, 2020 at 06:41:02PM -0500, Tom Lane wrote: > >> I'd be okay with a hook that there was a way to override ("yes, > >> I know what I'm doing, this doesn't require a catversion change"). > >> But there's no w

Re: pgsql: Add a non-strict version of jsonb_set

2020-01-19 Thread Tom Lane
Mark Dilger writes: > On Jan 19, 2020, at 12:20 PM, David Fetter wrote: >> On Sun, Jan 19, 2020 at 12:46:19PM -0500, Tom Lane wrote: >>> I think you are right that individual committers could set up such hooks >>> in their own private repos. But that's not what was being suggested, >>> or so I t

Re: pgsql: Add a non-strict version of jsonb_set

2020-01-19 Thread Mark Dilger
> On Jan 19, 2020, at 12:20 PM, David Fetter wrote: > > On Sun, Jan 19, 2020 at 12:46:19PM -0500, Tom Lane wrote: >> David Fetter writes: >>> On Fri, Jan 17, 2020 at 06:41:02PM -0500, Tom Lane wrote: I'd be okay with a hook that there was a way to override ("yes, I know what I'm doi

Re: pgsql: Add a non-strict version of jsonb_set

2020-01-19 Thread David Fetter
On Sun, Jan 19, 2020 at 12:46:19PM -0500, Tom Lane wrote: > David Fetter writes: > > On Fri, Jan 17, 2020 at 06:41:02PM -0500, Tom Lane wrote: > >> I'd be okay with a hook that there was a way to override ("yes, > >> I know what I'm doing, this doesn't require a catversion change"). > >> But there

Re: pgsql: Add a non-strict version of jsonb_set

2020-01-19 Thread Tom Lane
David Fetter writes: > On Fri, Jan 17, 2020 at 06:41:02PM -0500, Tom Lane wrote: >> I'd be okay with a hook that there was a way to override ("yes, >> I know what I'm doing, this doesn't require a catversion change"). >> But there's no way to do that is there? > I'm pretty sure there is. The prog

Re: pgsql: Add a non-strict version of jsonb_set

2020-01-19 Thread David Fetter
On Fri, Jan 17, 2020 at 06:41:02PM -0500, Tom Lane wrote: > Andrew Dunstan writes: > >> On Jan 17, 2020, at 12:44 PM, Tom Lane wrote: > >>> Shoulda been a catversion bump in here, if only for protocol's sake. > > > I'd love to have a git pre-commit hook that would warn about this, it > > seems t

Re: pgsql: Add a non-strict version of jsonb_set

2020-01-17 Thread Tom Lane
Andrew Dunstan writes: >> On Jan 17, 2020, at 12:44 PM, Tom Lane wrote: >>> Shoulda been a catversion bump in here, if only for protocol's sake. > I'd love to have a git pre-commit hook that would warn about this, it > seems to happen several times a year, and I know I've transgressed > more tha

Re: pgsql: Add a non-strict version of jsonb_set

2020-01-17 Thread Andrew Dunstan
On Fri, Jan 17, 2020 at 1:50 PM Andrew Dunstan wrote: > > > > > > > On Jan 17, 2020, at 12:44 PM, Tom Lane wrote: > > > > Andrew Dunstan writes: > >> Add a non-strict version of jsonb_set > > > > Shoulda been a catversion bump in here, if only for protocol's sake. > > > > (A useful rule of thum

Re: pgsql: Add a non-strict version of jsonb_set

2020-01-16 Thread Andrew Dunstan
> On Jan 17, 2020, at 12:44 PM, Tom Lane wrote: > > Andrew Dunstan writes: >> Add a non-strict version of jsonb_set > > Shoulda been a catversion bump in here, if only for protocol's sake. > > (A useful rule of thumb is "if you won't pass the regression tests > without doing an initdb, t

Re: pgsql: Add a non-strict version of jsonb_set

2020-01-16 Thread Tom Lane
Andrew Dunstan writes: > Add a non-strict version of jsonb_set Shoulda been a catversion bump in here, if only for protocol's sake. (A useful rule of thumb is "if you won't pass the regression tests without doing an initdb, there should be a catversion change".) regards,

pgsql: Add a non-strict version of jsonb_set

2020-01-16 Thread Andrew Dunstan
Add a non-strict version of jsonb_set jsonb_set_lax() is the same as jsonb_set, except that it takes and extra argument that specifies what to do if the value argument is NULL. The default is 'use_json_null'. Other possibilities are 'raise_exception', 'return_target' and 'delete_key', all these be