Skip site navigation (1) Skip section navigation (2)

Re: BUG #4748: hash join and sort-merge join make different results

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Roman Kononov <kononov(at)ftml(dot)net>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4748: hash join and sort-merge join make different results
Date: 2009-04-03 19:57:48
Message-ID: 21030.1238788668@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> Roman Kononov wrote:
>> 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;

> Reproducible in 8.2.13 as well ..

The problem is that interval_cmp_internal(), and hence interval_eq(),
says that '1 month' = '30 days'.  But they don't hash to the same thing.

I think we could fix this by having interval_hash() duplicate the
total-span calculation done by interval_cmp_internal, and then return
the hash of the resulting TimeOffset.  This is going to break existing
hash indexes on intervals, but there seems little choice...

			regards, tom lane

In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2009-04-03 20:18:25
Subject: Re: BUG #4748: hash join and sort-merge join make different results
Previous:From: Dickson S. GuedesDate: 2009-04-03 19:46:51
Subject: Re: BUG #4748: hash join and sort-merge join make differentresults

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group