On Thu, Aug 1, 2024 at 3:52 PM Tom Lane <t...@sss.pgh.pa.us> wrote: > I complained in the discussion of bug #18564 [1] that it's quite > inconsistent that you can cast a jsonb null to text and get > a SQL NULL: > > =# select ('{"a": null}'::jsonb)->>'a'; > ?column? > ---------- > > (1 row)
Oddly, it looks like you only get a null if you use the '->>' operator. With '->' and a subsequent cast to text, you get the string "null": maciek=# select (('{"a":null}'::jsonb)->'a')::text; text ------ null (1 row) Is that expected?