Re: [HACKERS] Definitional issue for INET types - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [HACKERS] Definitional issue for INET types
Date
Msg-id Pine.GSO.4.02A.10002171305400.2933-100000@Oxe.DoCS.UU.SE
Whole thread Raw
In response to Definitional issue for INET types  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Definitional issue for INET types
List pgsql-hackers
On Thu, 17 Feb 2000, Tom Lane wrote:

>     '10.1.2.3/8'::inet     '10.0.0.0/32'::cidr
> The old code believes that the first of these is greater, while my
> revised code thinks the second is greater.

I think we can flip a three-sided coin here:

1) '10.1.2.3/8'::inet is not a valid inet input value, sort of in the same
way as 10.5 is not a valid integer.

2) You coerce '10.1.2.3/8'::inet to essentially '10.0.0.0/8'::inet on
input. (In some parts, implicit data mangling that loses information is
not considered good practice.)

3) You can't compare inet and cidr because they're two different (albeit
similar) things. If you want to compare them you have to explicitly cast
inet to cidr or vice versa according to 1) or 2).

In any case I believe you revised code has a very good point.


-- 
Peter Eisentraut                  Sernanders vaeg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden



pgsql-hackers by date:

Previous
From: Sevo Stille
Date:
Subject: Re: [HACKERS] Definitional issue for INET types
Next
From: "Jeff MacDonald "
Date:
Subject: PC Week PostgreSQL benchmark results posted online (fwd)