inconsistent jsonb 'null' conversions

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: inconsistent jsonb 'null' conversions
Date: 2026-07-05 12:58:27
Message-ID: CAFj8pRCX_a0wo5AD5ZvTJ=x-GnxVP7PoneJM-QyQcptM4TLpMA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

I found inconsistency in casting the value "null" of jsonb type to scalar
types.

(2026-07-05 14:54:08) postgres=# select 'null'::jsonb::int is null;
┌──────────┐
│ ?column? │
╞══════════╡
│ t │
└──────────┘
(1 row)

(2026-07-05 14:56:26) postgres=# select 'null'::jsonb::varchar is null;
┌──────────┐
│ ?column? │
╞══════════╡
│ f │
└──────────┘
(1 row)

Is it expected behaviour?

Regards

Pavel

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dongpo Liu 2026-07-05 13:27:20 [PATCH] Remove unused include from analyze.c
Previous Message Peter Eisentraut 2026-07-05 11:57:41 Re: (SQL/PGQ) Clean up orphaned properties when dropping a label