Skip site navigation (1) Skip section navigation (2)

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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Vadim Mikheev <vadim(at)krs(dot)ru>
Cc: Frank Cusack <fcusack(at)iconnet(dot)net>, pgsql-bugs(at)postgreSQL(dot)org, PostgreSQL Developers List <hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] Re: [BUGS] uniqueness not always correct
Date: 1999-11-11 16:57:59
Message-ID: 15334.942339479@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-hackers
Vadim Mikheev <vadim(at)krs(dot)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

Responses

pgsql-hackers by date

Next:From: Bruce MomjianDate: 1999-11-11 18:21:34
Subject: psql and \p\g
Previous:From: Thomas LockhartDate: 1999-11-11 15:56:18
Subject: Re: [HACKERS] Indent

pgsql-bugs by date

Next:From: Frank CusackDate: 1999-11-11 20:50:59
Subject: Re: [HACKERS] Re: [BUGS] uniqueness not always correct
Previous:From: Vadim MikheevDate: 1999-11-11 10:07:25
Subject: Re: [BUGS] uniqueness not always correct

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group