Re: [HACKERS] Re: [BUGS] uniqueness not always correct

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Re: [BUGS] uniqueness not always correct
Дата
Msg-id 15334.942339479@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [BUGS] uniqueness not always correct  (Vadim Mikheev <vadim@krs.ru>)
Ответы Re: [HACKERS] Re: [BUGS] uniqueness not always correct  (Frank Cusack <fcusack@iconnet.net>)
Re: [HACKERS] Re: [BUGS] uniqueness not always correct  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: [HACKERS] Re: [BUGS] uniqueness not always correct  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: [HACKERS] Re: [BUGS] uniqueness not always correct  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-bugs
Vadim Mikheev <vadim@krs.ru> writes:
> Yes, I reproduced this (Solaris 2.5/sparc).
> Seems like CIDR problem(??!):

Yes.  Looks like the low-order bits of a CIDR address are garbage,
but network_cmp() compares them as though all bits are significant.
So, indeed, it may think two different instances of '1.2.3/24'
are not equal.

The regular inet comparison functions at least *try* to mask out
garbage bits, but I think they get it wrong too --- they should be
taking the smaller of ip_bits(a1) and ip_bits(a2) as the number of
bits to compare.  They don't.  Thus, for example,

regression=> select '1.2.5/16'::cidr < '1.2.3/24'::cidr;
?column?
--------
f
(1 row)

which looks wrong to me.

In short, it's a bug in the inet data types, not a generic problem
with unique indexes.

            regards, tom lane

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

Предыдущее
От: Vadim Mikheev
Дата:
Сообщение: Re: [BUGS] uniqueness not always correct
Следующее
От: Frank Cusack
Дата:
Сообщение: Re: [HACKERS] Re: [BUGS] uniqueness not always correct