From: | "Mathieu Dupuis" <mdupuis(at)premieresloges(dot)ca> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #4936: Bad result for SQL query |
Date: | 2009-07-23 15:45:01 |
Message-ID: | 200907231545.n6NFj1cs051379@wwwmaster.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged online:
Bug reference: 4936
Logged by: Mathieu Dupuis
Email address: mdupuis(at)premieresloges(dot)ca
PostgreSQL version: 8.4.0
Operating system: Ubuntu
Description: Bad result for SQL query
Details:
I have found a probleme with a sql query that I run in one of my program.
I have simplified the query as much as I can to figure out what the problem
is. Have have also compere the result with the same data between postgresql
8.4 and postgresql 8.3 and the resultset is different.
Here are the result of the simplest query that recreate the problem, as you
can see the p.id and sod.performance_id are the same because I join on those
fields but if I compare with one, I have a different result that if I
compare the other.
-- 1) Return 1 rows (bad)
select p.performance_datetime, sod.id
from saleorder_details sod, performance p, sale
where p.id in (select 21030434)
and p.id = sod.performance_id
and sale.id = sod.sale_id;
-- 2) Return many rows (good)
select p.performance_datetime, sod.id
from saleorder_details sod, performance p, sale
where p.id in (21030434)
and p.id = sod.performance_id
and sale.id = sod.sale_id;
-- 3) Return many rows (good)
select p.performance_datetime, sod.id
from saleorder_details sod, performance p, sale
where sod.performance_id in (select 21030434)
and p.id = sod.performance_id
and sale.id = sod.sale_id;
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-07-23 16:22:22 | Re: BUG #4936: Bad result for SQL query |
Previous Message | Tom Lane | 2009-07-23 15:21:54 | Re: BUG #4935: Weird input syntax for intervals, part 2 |