Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZNREk-00080e-LJ for pgsql-sql@arkaria.postgresql.org; Thu, 06 Aug 2015 19:53:59 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZNREj-0007Ff-VI for pgsql-sql@arkaria.postgresql.org; Thu, 06 Aug 2015 19:53:58 +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 1ZNREh-0007Di-Sm for pgsql-sql@postgresql.org; Thu, 06 Aug 2015 19:53:56 +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 1ZNREe-00070F-Rb for pgsql-sql@postgresql.org; Thu, 06 Aug 2015 19:53:54 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 84A552043D for ; Thu, 6 Aug 2015 15:53:51 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute2.internal (MEProxy); Thu, 06 Aug 2015 15:53:51 -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=vho0AR+YZYi22L5Brun67uDxLF8=; b=VSSgPe gr+s6v6hr3A6AGX6a2Jlf9BwMN2FKdAhezEoT4F34UcX0q8DU/WZkY1h5J1gJfCp 64yUmbMH86F9FFV+muJVBaw/FEaTI9IFsEWBl68ScWXWAvo+TapdSN9OTyDQXliM GYzmg3QevBiC7U9ooZJAAPxF35Swp0/BrQmNo= 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=vho0AR+YZYi22L5 Brun67uDxLF8=; b=scODPyIhK0FrA7Y2KEnjHs/2LGzsll2Na0eeQ5DGpn0UGYw +kMc5DscpmsK2fyusiU9Af0LkPAWf8Q+ImahPYlAZJF+9RgSqIhOyTK2LOL6a6K2 OHg4FuOlyruP9kgmqGLzh+Kn5VR9W5N/rdu4QFBz5xEeMtmBWkYg4VW2Hskg= X-Sasl-enc: RHoJUWI7wWVrhwOtcu+zghAt7p2tU29SYUj4MlW1wIV3 1438890831 Received: from [192.168.1.3] (174-21-248-106.tukw.qwest.net [174.21.248.106]) by mail.messagingengine.com (Postfix) with ESMTPA id 06F0A680118; Thu, 6 Aug 2015 15:53:50 -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> <55C39320.4010905@aklaver.com> <16388.1438888231@sss.pgh.pa.us> <10B2FB45-DFE8-4075-BFB0-36023ADF9837@klingler.net> From: Adrian Klaver Message-ID: <55C3BB3D.2020103@aklaver.com> Date: Thu, 6 Aug 2015 12:53:33 -0700 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <10B2FB45-DFE8-4075-BFB0-36023ADF9837@klingler.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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 12:35 PM, Richard RK. Klingler wrote: > Thanks to all for the clarifications... > > I'm looking at this form an application perspective... > as this would greatly enhance an IPAM database web application. > > Sad there is no direct IP address sorting function like in MySQL (o; http://www.postgresql.org/docs/9.2/static/datatype-net-types.html "When sorting inet or cidr data types, IPv4 addresses will always sort before IPv6 addresses, including IPv4 addresses encapsulated or mapped to IPv6 addresses, such as ::10.2.3.4 or ::ffff:10.4.3.2." So: test=# create table inet_test(i_fld inet); CREATE TABLE test=# insert into inet_test values ('192.0.1.2'); INSERT 0 1 test=# insert into inet_test values ('192.0.0.3'); INSERT 0 1 test=# insert into inet_test values ('192.0.1.165'); INSERT 0 1 test=# select * from inet_test order by i_fld ; i_fld ------------- 192.0.0.3 192.0.1.2 192.0.1.165 > > > cheers from .ch > richard > > > > > Am [DATE] schrieb "pgsql-sql-owner@postgresql.org im Auftrag von Tom Lane" <[ADDRESS]>: > >> "David G. Johnston" writes: >>> On Thu, Aug 6, 2015 at 10:02 AM, Adrian Klaver >>> wrote: >>>> " 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. >> >>> This seems overly simplified given that "<<=" will indeed match two host >>> specifications. >> >> No, only one. There is no difference between '192.168.0.1'::inet and >> '192.168.0.1/32'::inet; they're the same value. The first notation >> is merely a shorthand for the second. >> >> regards, tom lane >> >> >> -- >> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) >> To make changes to your subscription: >> http://www.postgresql.org/mailpref/pgsql-sql > -- 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