Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 741541337B5A for ; Mon, 11 Oct 2010 20:50:14 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 47105-02 for ; Mon, 11 Oct 2010 23:50:07 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 04DA41337B53 for ; Mon, 11 Oct 2010 20:50:06 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o9BNo6jm008974; Mon, 11 Oct 2010 19:50:07 -0400 (EDT) To: "Andreas Karlsson" cc: pgsql-bugs@postgresql.org Subject: Re: BUG #5705: btree_gist: Index on inet changes query result In-reply-to: <201010112055.o9BKtZf7011251@wwwmaster.postgresql.org> References: <201010112055.o9BKtZf7011251@wwwmaster.postgresql.org> Comments: In-reply-to "Andreas Karlsson" message dated "Mon, 11 Oct 2010 20:55:35 +0000" Date: Mon, 11 Oct 2010 19:50:06 -0400 Message-ID: <8973.1286841006@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201010/101 X-Sequence-Number: 28391 "Andreas Karlsson" writes: > I was looking at the code to see how one would improve indexing of the inet > types and saw an inconsistency between the compressed format > (gbt_inet_compress) and how network_cmp_internal works. The btree_gist > module ignores the netmask. Well, actually the btree_gist implementation for inet is a completely broken piece of junk: it thinks that convert_network_to_scalar is 100% trustworthy and can be used as a substitute for the real comparison functions, which isn't even approximately true. I'm not sure why Teodor implemented it like that instead of using the type's real comparison functions, but it's pretty much useless if you want the same sort order that the type itself defines. regards, tom lane