Make jsonb casts to scalar types translate JSON null to SQL NULL.

Formerly, these cases threw an error "cannot cast jsonb null to type
<whatever>".  That seems less than helpful though.  It's also
inconsistent with the behavior of the ->> operator, which translates
JSON null to SQL NULL, as do some other jsonb functions.

Discussion: https://postgr.es/m/3851203.1722552...@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a5579a90af05814eb5dc2fd5f68ce803899d2504

Modified Files
--------------
src/backend/utils/adt/jsonb.c       | 77 +++++++++++++++++++++++++++++++++----
src/test/regress/expected/jsonb.out | 66 +++++++++++++++++++++++++++++++
src/test/regress/sql/jsonb.sql      | 13 +++++++
3 files changed, 149 insertions(+), 7 deletions(-)

Reply via email to