Re: inet/cidr type comparisons

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: inet/cidr type comparisons
Дата
Msg-id 4991.992275434@sss.pgh.pa.us
обсуждение исходный текст
Ответ на inet/cidr type comparisons  (Alex Pilosov <alex@pilosoft.com>)
Ответы Re: inet/cidr type comparisons  (Alex Pilosov <alex@pilosoft.com>)
Список pgsql-hackers
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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Mikheev, Vadim"
Дата:
Сообщение: RE: Baby girl
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Baby girl