Re: Join works in 7.3.6, fails in 7.4.2

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Join works in 7.3.6, fails in 7.4.2
Date: 2004-04-13 20:51:00
Message-ID: 20040413205100.GA28390@quality.qadas.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Tue, Apr 13, 2004 at 03:42:54PM -0400, Tom Lane wrote:
> Michael Fuhr <mike(at)fuhr(dot)org> writes:
> > I have a query that works in 7.3.6 but not in 7.4.2 unless I turn
> > off enable_hashjoin. I'm joining a table of network interfaces and
> > a table of networks so I can find additional info about a particular
> > interface's network.
>
> Hmm. The inet = operator is marked hashable in 7.4 but not in 7.3 ...
> I wonder if that is a mistake? I recall looking at the datatype and
> deciding there were no insignificant bits in it, but that could be
> wrong. Or it could be that the network() function is taking some
> shortcut it shouldn't.

So would a workaround be to set oprcanhash to false for that
operator? I did the following and it appeared to solve the
problem:

UPDATE pg_operator SET oprcanhash = FALSE WHERE oid = 1201;

Or, without knowing that 1201 is the correct OID:

UPDATE pg_operator SET oprcanhash = FALSE
WHERE oprname = '='
AND oprleft IN (SELECT oid FROM pg_type WHERE typname = 'inet');

> Is any of this data IPv6 addresses by any chance?

Nope -- all IPv4.

> > From my sample data set (available upon request),
>
> Could we see the specific values that join in 7.3 and fail to do so in
> 7.4?

I can duplicate the problem with the following data:

INSERT INTO ipinterface VALUES (1, '10.0.1.1');
INSERT INTO ipinterface VALUES (2, '10.0.2.1');
INSERT INTO ipnet VALUES (10, '10.0.1.0/24');
INSERT INTO ipnet VALUES (20, '10.0.2.0/24');

Thanks for looking into this.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Kratz 2004-04-13 20:55:36 Re: insert rule not firing on insert with exists subselect
Previous Message Tom Lane 2004-04-13 20:40:29 Re: insert rule not firing on insert with exists subselect

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-04-13 21:03:43 Re: Join works in 7.3.6, fails in 7.4.2
Previous Message Jim Seymour 2004-04-13 20:37:37 Re: make == as = ?