Re: BUG #19735: `jsonb_object_agg_unique_strict` drops a JSONB `null` value as if it were SQL NULL - Mailing list pgsql-bugs

From shihao zhong
Subject Re: BUG #19735: `jsonb_object_agg_unique_strict` drops a JSONB `null` value as if it were SQL NULL
Date
Msg-id CAGRkXqSpWKiSUqBtcsDFDPCvbzALM+BnJN26DKu03TwPL3cRZg@mail.gmail.com
Whole thread
In response to Re: BUG #19735: `jsonb_object_agg_unique_strict` drops a JSONB `null` value as if it were SQL NULL  (Dmitry Dolgov <9erthalion6@gmail.com>)
Responses Re: BUG #19735: `jsonb_object_agg_unique_strict` drops a JSONB `null` value as if it were SQL NULL
List pgsql-bugs

Hi Dmitry,

I agree the docs should say which nulls are meant.

I am not sure it was intended though. The jsonb array functions keep
a JSON null, and JSON_OBJECT() drops the key only with RETURNING
jsonb:

  SELECT JSON_OBJECT('a': 'null'::jsonb ABSENT ON NULL RETURNING jsonb),
         JSON_OBJECT('a': 'null'::jsonb ABSENT ON NULL RETURNING json);
   {}          | {"a" : null}

Skipping only SQL NULLs needs no check per element in jsonb, the
caller knows which values it skipped. So I lean to SQL NULL only for
both. I would like a committer to pick, and the doc patch is attached.

Thanks,
Shihao
Attachment

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #19747: pg_dump does not pin array_nulls, so restore mangles NULL array elements
Next
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: RE: Streaming decoding fails with "unexpected table_index_fetch_tuple call during logical decoding" when a relation has a TOASTed conbin (follow-up to BUG #18641)