From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: knz@thaumogen.net
Subject: BUG #15297: Irregular comparison rules for NULLs in tuples
Date: Thu, 26 Jul 2018 13:35:27 +0000
Message-ID: <153261212701.1395.18260320763646237974@wrigleys.postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 15297
Logged by: kena
Email address: knz@thaumogen.net
PostgreSQL version: 10.4
Operating system: FreeBSD + Linux
Description:
The SQL standard mandates ternary logic for values that involve NULL, where
NULL means "unknown".
This works in many cases correctly in pg:
"select NULL in (1,2)" -> returns NULL, correct
"select (1, NULL::int) in ((1, 1), (1, 2))" -> returns NULL, correct
"select 1 < NULL" -> returns NULL, correct
"select (1, NULL::int) > (1, 2)" -> returns NULL, correct
However as soon as a tuple/composite value contains itself composites, the
rule is not obeyed any more recursively:
"select (1, (1, NULL::int)) in ((1, (1, 0)), (1, (1, 2)))" -> returns false
!?
"select (1, (1, NULL::int)) > (1, (1, 2))" -> returns true !?
Is this intended behavior? If so, where is it documented?
If not documented, any suggestion as to how to work around it?
Thanks in advance,
--
Raphael 'kena' Poss
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, knz@thaumogen.net
Subject: Re: BUG #15297: Irregular comparison rules for NULLs in tuples
In-Reply-To: <153261212701.1395.18260320763646237974@wrigleys.postgresql.org>
References: <153261212701.1395.18260320763646237974@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox