From: Wilm Hoyer <W.Hoyer@dental-vision.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: AW: XML column causes record to be both NULL and NOT NULL
Date: Wed, 5 Jul 2023 06:43:57 +0000
Message-ID: <462567f501af4621964bccacaf824590@dental-vision.de> (raw)
In-Reply-To: <881845.1688497164@sss.pgh.pa.us>
References: <3a116b87d6eb4a6a8040749c991fe961@dental-vision.de>
<881845.1688497164@sss.pgh.pa.us>
> Well, it is strange, but it's acting per SQL spec.
> As stated at [1]:
>> If the expression is row-valued, then IS NULL is true when the row
>> expression itself is null or when all the row's fields are null, while
>> IS NOT NULL is true when the row expression itself is non-null and all
>> the row's fields are non-null. Because of this behavior, IS NULL and
>> IS NOT NULL do not always return inverse results for row-valued
>> expressions; in particular, a row-valued expression that contains both
>> null and non-null fields will return false for both tests.
> The fact that the added column is of XML type isn't relevant here; what's relevant is that it has a null value.
> regards, tom lane
> [1] https://www.postgresql.org/docs/current/functions-comparison.html
Thanks for the Explanation. The solution is clear then - just test part of the record or "flatten" the record with a cast to text.
Best regards,
Wilm.
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: W.Hoyer@dental-vision.de, tgl@sss.pgh.pa.us
Subject: Re: XML column causes record to be both NULL and NOT NULL
In-Reply-To: <462567f501af4621964bccacaf824590@dental-vision.de>
References: <3a116b87d6eb4a6a8040749c991fe961@dental-vision.de> <881845.1688497164@sss.pgh.pa.us> <462567f501af4621964bccacaf824590@dental-vision.de>
* 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