From: Renat <renat.nasyrov@itv.ru>
To: pgsql-bugs@postgresql.org
Subject: BUG #6079: Wrong select result
Date: Tue, 28 Jun 2011 14:41:30 GMT
Message-ID: <201106281441.p5SEfU5x051446@wwwmaster.postgresql.org> (raw)
The following bug has been logged online:
Bug reference: 6079
Logged by: Renat
Email address: renat.nasyrov@itv.ru
PostgreSQL version: 9.0.4
Operating system: Windows
Description: Wrong select result
Details:
INPUT:
create table foo (
id bigint not null,
date_to timestamp without time zone,
CONSTRAINT foo_pkey PRIMARY KEY (id)
);
CREATE INDEX foo_date_to_index
ON foo
USING btree
(date_to)
insert into foo (id, date_to) values (1, now());
insert into foo (id, date_to) values (2, NULL);
select * from foo where date_to is null and date_to > '2011-01-01'
Expected: 0 rows
But: it return 1 row with id=2
If we will replace foo_date_to_index to:
CREATE INDEX foo_date_to_index
ON foo
USING btree
(date_to)
WHERE date_to is NOT NULL
Then:
SELECT * FROM foo where date_to is null and date_to > '2011-01-01'
Return: 0 rows
Please explain for me what happens?
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: renat.nasyrov@itv.ru
Subject: Re: BUG #6079: Wrong select result
In-Reply-To: <201106281441.p5SEfU5x051446@wwwmaster.postgresql.org>
References: <201106281441.p5SEfU5x051446@wwwmaster.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