Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 5552FB5DBE2 for ; Thu, 28 Jul 2011 20:58:08 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 54280-03 for ; Thu, 28 Jul 2011 23:58:02 +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 E2037B5DBC1 for ; Thu, 28 Jul 2011 20:58:01 -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 p6SNw104009135; Thu, 28 Jul 2011 19:58:01 -0400 (EDT) To: Dhaval Shah cc: pgsql-admin@postgresql.org Subject: Re: A question on using CIDR datatype for both ipv6 and ipv4 address In-reply-to: References: Comments: In-reply-to Dhaval Shah message dated "Thu, 28 Jul 2011 16:29:28 -0700" Date: Thu, 28 Jul 2011 19:58:01 -0400 Message-ID: <9134.1311897481@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-3.093 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-1.193 X-Spam-Level: X-Archive-Number: 201107/202 X-Sequence-Number: 37981 Dhaval Shah writes: > Let me know why I am not getting similar results when the RHS is an > IPV4 in IPV6 format vs, the RHS in IPV4 format. AFAIR, the inet/cidr types consider IPv4 to be an independent set of values that sort in front of all IPv6 values. The notion that IPv4 might be embedded in some part of the IPv6 space is not something that that code is aware of. If it did try to do that, you'd have '::ffff:192.0.2.124' comparing as equal to '192.0.2.124', which would be okay for some purposes but not all. regards, tom lane