pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Wilm Hoyer <W.Hoyer@dental-vision.de>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: XML column causes record to be both NULL and NOT NULL
Date: Tue, 04 Jul 2023 14:59:24 -0400
Message-ID: <881845.1688497164@sss.pgh.pa.us> (raw)
In-Reply-To: <3a116b87d6eb4a6a8040749c991fe961@dental-vision.de>
References: <3a116b87d6eb4a6a8040749c991fe961@dental-vision.de>

Wilm Hoyer <W.Hoyer@dental-vision.de> writes:
> i found a strange behavior and hope it's not a pilot error.

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





view thread (6+ messages)

Message-ID: <881845.1688497164@sss.pgh.pa.us>
Permalink:  ../881845.1688497164@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/881845.1688497164@sss.pgh.pa.us

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, W.Hoyer@dental-vision.de, pgsql-bugs@lists.postgresql.org
  Subject: Re: XML column causes record to be both NULL and NOT NULL
  In-Reply-To: <881845.1688497164@sss.pgh.pa.us>

* 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