From: Tom Lane <tgl@sss.pgh.pa.us>
To: kwalbrecht@cghtech.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6644: Query give wrong results when 'is not null' is applied in where clause
Date: Wed, 16 May 2012 20:04:18 -0400
Message-ID: <7501.1337213058@sss.pgh.pa.us> (raw)
In-Reply-To: <E1SUf4z-0002Yu-1y@wrigleys.postgresql.org>
References: <E1SUf4z-0002Yu-1y@wrigleys.postgresql.org>
kwalbrecht@cghtech.com writes:
> geom.ArcToStreight(integer) is a function which returns the following type:
> The following queries show 1) the total number of rows. 2) the number of
> null rows. 3) the number of not null rows.
> The problem is that results of query 2 + the results of query 3 should equal
> the result of query 1 which they do not.
Well, you didn't provide enough detail to let somebody else reproduce
the problem, but I suspect your issue is that IS NULL and IS NOT NULL
are not all the possible states of a composite value. Per
http://www.postgresql.org/docs/9.0/static/functions-comparison.html
Note: 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,
i.e., a row-valued expression that contains both NULL and
non-null values will return false for both tests. This
definition conforms to the SQL standard, and is a change from
the inconsistent behavior exhibited by PostgreSQL versions prior
to 8.2.
regards, tom lane
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: tgl@sss.pgh.pa.us, kwalbrecht@cghtech.com
Subject: Re: BUG #6644: Query give wrong results when 'is not null' is applied in where clause
In-Reply-To: <7501.1337213058@sss.pgh.pa.us>
References: <E1SUf4z-0002Yu-1y@wrigleys.postgresql.org> <7501.1337213058@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