Inconsistencies around Composite Row nullness

From: Chris Hanks <christopher(dot)m(dot)hanks(at)gmail(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Inconsistencies around Composite Row nullness
Date: 2025-11-02 16:52:20
Message-ID: CAK7KUdApoBTLAEL0z+5U9Yv_o4gu6JTU9uC3_AZWSXSjm5jjGQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello -

I've experienced some logically inconsistent query output on my local
Postgres instance, version string: PostgreSQL 18.0 (Homebrew) on
aarch64-apple-darwin25.0.0, compiled by Apple clang version 17.0.0
(clang-1700.3.19.1), 64-bit

I also reproduced it on the most recent Postgres version available at
db-fiddle.com, version string: PostgreSQL 17.0 on x86_64-pc-linux-gnu,
compiled by gcc (GCC) 11.4.1 20230605 (Red Hat 11.4.1-2), 64-bit

This first statement resolves, reasonably, to NULL:
SELECT ROW(NULL::integer, 2) = ROW(NULL::integer, 2)

This next statement resolves to ROW(NULL, 2):
SELECT coalesce(ROW(NULL::integer, 2), ROW(1, 2))

These final two statements each resolve to true, which is inconsistent with
the previous statements (each should resolve to NULL):
SELECT coalesce(ROW(NULL::integer, 2), ROW(1, 2)) = ROW(NULL::integer, 2)
SELECT coalesce(ROW(NULL::integer, 2)) = ROW(NULL::integer, 2)

Thank you!
Chris

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2025-11-02 18:19:53 Re: Inconsistencies around Composite Row nullness
Previous Message Tom Lane 2025-11-02 16:35:26 Re: BUG #19101: Ceil on BIGINT could lost precision in decil function