Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZNOZT-0008I5-Il for pgsql-sql@arkaria.postgresql.org; Thu, 06 Aug 2015 17:03:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZNOZT-00054E-4p for pgsql-sql@arkaria.postgresql.org; Thu, 06 Aug 2015 17:03:11 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZNOYV-0003Tv-0x for pgsql-sql@postgresql.org; Thu, 06 Aug 2015 17:02:11 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZNOYS-0003ij-HQ for pgsql-sql@postgresql.org; Thu, 06 Aug 2015 17:02:09 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id EFBF020C47 for ; Thu, 6 Aug 2015 13:02:06 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute3.internal (MEProxy); Thu, 06 Aug 2015 13:02:06 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=aklaver.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=H4u7s0gLiYELS1QNsATe543iYqU=; b=fjao+t tjXdNREQ/vF/wdxuBI00gLFTc/Sl9pY8jV5rWcYk7vkwEXgbtXaYbsGPUP9xn5qN 0kgeugiACQG1/eZsjBQCFZWzouoAR5yByT36t8rUktmVAW/+VTgVp+ZY9jRjhe2Y EUWPxN1qmV6P1KP6zkCGfzNv5uakFxkQOmyWo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=H4u7s0gLiYELS1Q NsATe543iYqU=; b=NTbBfAJQrpWgJQIO8ikmKpwWs1MTaGIj05K68ajUklyaAhn vV+2OSUftsb0nQahLOehXHbIMjlfrgX5shlWEsoAwVe54ArQBGEKRiue9w4q8EUG VUFE0prnHmEORb9+dQAvkW8q63Gi2Hm/h5i589XTZq3Cv9gzYnHoU+8djsjk= X-Sasl-enc: aB5DoKuJt0fpn9mpXQgNautZUJYSs6lcOyL9KDFI7SGW 1438880526 Received: from killi.site (unknown [74.94.73.222]) by mail.messagingengine.com (Postfix) with ESMTPA id 7E2F86800F0; Thu, 6 Aug 2015 13:02:06 -0400 (EDT) Subject: Re: IP address, subnet query behaves wrong for /32 To: "Richard RK. Klingler" , "pgsql-sql@postgresql.org" References: <1FC8E571-8456-4085-B59B-016ECD365768@klingler.net> From: Adrian Klaver Message-ID: <55C39320.4010905@aklaver.com> Date: Thu, 6 Aug 2015 10:02:24 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <1FC8E571-8456-4085-B59B-016ECD365768@klingler.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org On 08/06/2015 09:47 AM, Richard RK. Klingler wrote: > Evenin' > > What I discovered just lately is a nice feature from pgsql that I can test > if a specific IP address falls within a supplied subnet: > > myserver=# select inet '192.168.0.1' << '192.168.0.0/24'::inet as ip; > > ip > > ---- > > t > > (1 row) > > > > But what I don't understand is why pgsql doesn't behave correctly when > testing for a /32 subnet: > (it works for /31 correctly though) > > myserver=# select inet '192.168.0.1' << '192.168.0.1/32'::inet as ip; > > ip > > ---- > > f > > > From a network engineering point of view this should also return "true" > and not false. http://www.postgresql.org/docs/9.2/interactive/functions-net.html "The operators <<, <<=, >>, and >>= test for subnet inclusion." http://www.postgresql.org/docs/9.2/interactive/datatype-net-types.html#DATATYPE-INET " If the netmask is 32 and the address is IPv4, then the value does not indicate a subnet, only a single host." So it is behaving as documented. > > Has this been fixed in recent versions? I'm using 9.2.8 right now…. > > > > thanks in advance > richard > > -- Adrian Klaver adrian.klaver@aklaver.com -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql