Inconsistencies around Composite Row nullness
Chris Hanks <christopher.m.hanks@gmail.com>
From: Chris Hanks <christopher.m.hanks@gmail.com>
To: pgsql-bugs@lists.postgresql.org
Date: 2025-11-02T16:52:20Z
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