Re: possible wierd boolean bug? - Mailing list pgsql-hackers

From Merlin Moncure
Subject Re: possible wierd boolean bug?
Date
Msg-id 6EE64EF3AB31D5448D0007DD34EEB3412A756C@Herge.rcsinc.local
Whole thread Raw
In response to possible wierd boolean bug?  ("Merlin Moncure" <merlin.moncure@rcsonline.com>)
Responses Re: possible wierd boolean bug?
Re: possible wierd boolean bug?
Re: possible wierd boolean bug?
List pgsql-hackers
I confirmed the problem on a linux server running beta3...so this
problem is quite reproducible by running the attached scripts on a
freshly loaded database.

To reproduce the problem [adjust host,etc as necessary]:
1. type/cat test_boolean.sql | psql template1 (this will create a
database called 'test', connect to it, and load a few things.)
2. bzip -cd < poline.bzip | psql test (this will load a table into test
that was dumped via pg_dump)
3. try the following query:
select 1::int4, * from data1.po_line_file
  where    pol_po_no =  '00000002' and
          (pol_po_no =  '00000002' and pol_po_rel_no =  0) and
          (pol_po_no =  '00000002' and pol_po_rel_no =  0 and
pol_item_no =  '1570');

it should return 0 rows.

Try it with explain/analyze which reports 4 rows.
Try it a third time as:

select 1::int4, * from data1.po_line_file
  where   -- pol_po_no =  '00000002' and
          -- (pol_po_no =  '00000002' and pol_po_rel_no =  0) and
          (pol_po_no =  '00000002' and pol_po_rel_no =  0 and
pol_item_no =  '1570');

which is logically equivalent to the first form (isn't it?) and this
returns 1 row (the correct answer).

Merlin

Attachment

pgsql-hackers by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: cant write to file within call handler interface
Next
From: Tom Lane
Date:
Subject: Re: bgwriter changes