Re: [HACKERS] Definitional issue for INET types

From: Peter Eisentraut <e99re41(at)DoCS(dot)UU(dot)SE>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Definitional issue for INET types
Date: 2000-02-17 12:10:49
Message-ID: Pine.GSO.4.02A.10002171305400.2933-100000@Oxe.DoCS.UU.SE
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff MacDonald <jeff@pgsql.com> 2000-02-17 14:10:35 PC Week PostgreSQL benchmark results posted online (fwd)
Previous Message Sevo Stille 2000-02-17 12:07:59 Re: [HACKERS] Definitional issue for INET types