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 CAGRkXqS5E2exQ4qoRedcDNvshPG4uff3rNu46b9+Mt2o-bSe-Q@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>)
List pgsql-bugs
Hi Dmitry,

> I presume jsonb_agg_transfn_worker have to be unified with the others.

I don't think the array code forgot it. skip_nulls is only used when
an object is finished, in uniqueifyJsonbObject(). Arrays never get
there, so setting it in jsonb_agg_transfn_worker() would change
nothing.

> From what I see it drops nulls due to ABSENT ON NULL

Right, ABSENT ON NULL is what drops it. What I meant is that the same
call keeps the key when it returns json:
    ABSENT ON NULL RETURNING jsonb    {}
    ABSENT ON NULL RETURNING json     {"a" : null}

So ABSENT ON NULL means two different things, depending on the result type.

> I mean to check per every element in the to be aggregated set.

For SQL NULL that check is PG_ARGISNULL(), which is already there.

Thanks,
Shihao

pgsql-bugs by date:

Previous
From: shihao zhong
Date:
Subject: Re: PostgreSQL 18.6/17.11: standby PANIC on restart after VM truncation
Next
From: Alexander Lakhin
Date:
Subject: Re: BUG #19488: Standby connection fails after dropping on login event trigger enabled always