Alex Pilosov <alex@pilosoft.com> writes:
> I noticed current wierd behaviour of a less/greater than comparisons of
> things involving inet/cidr:
> 10.1.2.3/8 is considered to be less than 10.0.0.0/32
And what's wrong with that? Essentially this comes from the conclusion
that 10/8 is less than 10.0.0.0/32, which I have no problem with.
> To me, this makes no sense. I think b and c should be transposed, and
> netmask comparison must be only used as a tiebreaker when the values are
> the same otherwise (such as, when comparing 10.1.2.3/8 and 10.1.2.3/32).
That would break the rule that network part is major sort key and host
part is minor sort key, which I think is useful behavior.
> For type cidr, same thing applies: currently, 10.1.2.0/24 is considered to
> be less than 10.0.0.0/8.
It is?
regression=# select '10.1.2.0/24'::cidr < '10.0.0.0/8'::cidr;?column?
----------f
(1 row)
regards, tom lane