The following bug has been logged online:
Bug reference: 4748
Logged by: Roman Kononov
Email address: kononov@ftml.net
PostgreSQL version: 8.3.7
Operating system: GNU/Linux x86_64
Description: hash join and sort-merge join make different results
Details:
test-std=# create table t(s int,i interval);
CREATE TABLE
test-std=# insert into t values (0,'30 days'), (1,'1 month');
INSERT 0 2
test-std=# select * from t as a, t as b where a.i=b.i;
s | i | s | i
---+---------+---+---------
0 | 30 days | 0 | 30 days
0 | 30 days | 1 | 1 mon
1 | 1 mon | 0 | 30 days
1 | 1 mon | 1 | 1 mon
(4 rows)
test-std=# analyze;
ANALYZE
test-std=# select * from t as a, t as b where a.i=b.i;
s | i | s | i
---+---------+---+---------
0 | 30 days | 0 | 30 days
1 | 1 mon | 1 | 1 mon
(2 rows)