From: | Gianni Ceccarelli <dakkar(at)thenautilus(dot)net> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Why does jsonb_set() remove non-mentioned keys? |
Date: | 2019-07-05 08:00:47 |
Message-ID: | 20190705090047.41600de5@nautilus |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Aha! I had mis-understood how "strict"-ness works.
Thank you David for the explanation!
Thomas: the two main pieces are these:
> SQL null and json null are represented differently
As far as SQL is concerned, `'null'::jsonb` is a valid (non-`NULL`)
value. The SQL part of Postgres doesn't "look inside" the jsonb value,
the same way it doesn't "look inside" numbers or strings or
whatever. It only cares if they're `NULL` or not, and then it passes
them to functions and operators (ok, it does look at boolean values
for `WHERE` clauses, but even `ORDER BY` is handled by comparison
operators)
> strict functions with sql null inputs yield sql null output without
> even executing the function
So when the SQL-level executor sees a call to any function declared
strict with some NULL parameters, it doesn't call the function at
all. `whatever_my_function('a string',1234,NULL)` is always `NULL`
--
Dakkar - <Mobilis in mobile>
GPG public key fingerprint = A071 E618 DD2C 5901 9574
6FE2 40EA 9883 7519 3F88
key id = 0x75193F88
From | Date | Subject | |
---|---|---|---|
Next Message | AYahorau | 2019-07-05 08:03:21 | Re: Active connections are terminated because of small wal_sender_timeout |
Previous Message | Laurenz Albe | 2019-07-05 07:21:44 | Re: Converting to identity columns with domains on PK columns |