Thread
-
Re: [HACKERS] Re: [BUGS] uniqueness not always correct
Tom Lane <tgl@sss.pgh.pa.us> — 1999-11-11T16:57:59Z
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
-
Re: [HACKERS] Re: [BUGS] uniqueness not always correct
Bruce Momjian <pgman@candle.pha.pa.us> — 1999-12-16T01:42:32Z
Never mind. Patch is fir mac, not inet. > 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 > > ************ > -- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
-
Re: [HACKERS] Re: [BUGS] uniqueness not always correct
Bruce Momjian <pgman@candle.pha.pa.us> — 2000-03-07T22:50:57Z
I have just applied a user patch to fix this reported problem. > 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 > > ************ > -- Bruce Momjian | http://www.op.net/~candle pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
-
Re: [HACKERS] Re: [BUGS] uniqueness not always correct
Tom Lane <tgl@sss.pgh.pa.us> — 2000-03-07T23:22:04Z
Bruce Momjian <pgman@candle.pha.pa.us> writes: > I have just applied a user patch to fix this reported problem. If you had read the followup, you would have seen that I have doubts about this patch, and in fact Ryan acknowledges that it probably doesn't do the right thing for INET. I think there is more work to do here. regards, tom lane
-
Re: [HACKERS] Re: [BUGS] uniqueness not always correct
Bruce Momjian <pgman@candle.pha.pa.us> — 2000-03-08T01:44:21Z
> Bruce Momjian <pgman@candle.pha.pa.us> writes: > > I have just applied a user patch to fix this reported problem. > > If you had read the followup, you would have seen that I have doubts > about this patch, and in fact Ryan acknowledges that it probably doesn't > do the right thing for INET. I think there is more work to do here. Reversed out. "I never met a patch I didn't like." :-) -- Bruce Momjian | http://www.op.net/~candle pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026