Re: BUG #6079: Wrong select result

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Renat <renat(dot)nasyrov(at)itv(dot)ru>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6079: Wrong select result
Date: 2011-06-28 17:16:14
Message-ID: BANLkTik8Ew3Hqf9Hpqwn88XDj=q0AM7DUA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello

It working as expected on 9.0.4 Linux. Please, can you recheck your
application? Try to use a console - psql,

postgres=# select * from foo where date_to is null and date_to > '2011-01-01';
id | date_to
----+---------
(0 rows)

Regards

Pavel Stehule

2011/6/28 Renat <renat(dot)nasyrov(at)itv(dot)ru>:
>
> The following bug has been logged online:
>
> Bug reference:      6079
> Logged by:          Renat
> Email address:      renat(dot)nasyrov(at)itv(dot)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?
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message tomas 2011-06-28 19:26:36 Re: BUG #6078: borrar usuario
Previous Message Renat 2011-06-28 14:41:30 BUG #6079: Wrong select result