Thread: Feature, my misconception or bug??

Feature, my misconception or bug??

From
Achilleus Mantzios
Date:
In PgSQL 7.4.12,

foodb=# SELECT '255.255.255.255/24'::cidr;
ERROR:  invalid cidr value: "255.255.255.255/24"
DETAIL:  Value has bits set to right of mask.
foodb=# 

SELECT '255.255.255.255/25'::cidr;       cidr
--------------------255.255.255.255/25
(1 row)

foodb=# 

in this case 
11111111.11111111.11111111.11111111 
has no bits set to right of                    8 LSB ^
??
-- 
-Achilleus



Re: Feature, my misconception or bug??

From
Peter Eisentraut
Date:
Am Mittwoch, 22. Februar 2006 13:04 schrieb Achilleus Mantzios:
> foodb=# SELECT '255.255.255.255/24'::cidr;
> ERROR:  invalid cidr value: "255.255.255.255/24"
> DETAIL:  Value has bits set to right of mask.

> in this case
> 11111111.11111111.11111111.11111111
> has no bits set to right of
>                      8 LSB ^

I'm sure you are aware that "1" is a set bit, so which part are you not 
understanding?

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/


Re: Feature, my misconception or bug??

From
Markus Schaber
Date:
Hi, Peter,

Peter Eisentraut wrote:
> Am Mittwoch, 22. Februar 2006 13:04 schrieb Achilleus Mantzios:
> 
>>foodb=# SELECT '255.255.255.255/24'::cidr;
>>ERROR:  invalid cidr value: "255.255.255.255/24"
>>DETAIL:  Value has bits set to right of mask.
> 
> 
>>in this case
>>11111111.11111111.11111111.11111111
>>has no bits set to right of
>>                     8 LSB ^
> 
> 
> I'm sure you are aware that "1" is a set bit, so which part are you not 
> understanding?

I guess he's confused by the fact that /24 complains about bits 25-31
beeing set, while /25 does not complain aobut bigs 26-31 beeing set.

HTH,
Markus

-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org


Re: Feature, my misconception or bug??

From
Markus Schaber
Date:
Achilleus Mantzios wrote:
> In PgSQL 7.4.12,
> 
> foodb=# SELECT '255.255.255.255/24'::cidr;
> ERROR:  invalid cidr value: "255.255.255.255/24"
> DETAIL:  Value has bits set to right of mask.
> foodb=# 
> 
> SELECT '255.255.255.255/25'::cidr;
>         cidr
> --------------------
>  255.255.255.255/25
> (1 row)

This one is refused in 8.1, so I guess that's a fixed bug.

HTH,
Markus


-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org


Re: Feature, my misconception or bug??

From
Achilleus Mantzios
Date:
O Peter Eisentraut έγραψε στις Feb 22, 2006 :

> Am Mittwoch, 22. Februar 2006 13:04 schrieb Achilleus Mantzios:
> > foodb=# SELECT '255.255.255.255/24'::cidr;
> > ERROR:  invalid cidr value: "255.255.255.255/24"
> > DETAIL:  Value has bits set to right of mask.
> 
> > in this case
> > 11111111.11111111.11111111.11111111
> > has no bits set to right of
> >                      8 LSB ^
> 
In the above statement there was a "?", which is missing here.

It should read:
"in this case 11111111.11111111.11111111.11111111 has no bits set to 
right of 8th Least Significant Bit???"
(with a ^ showing the position where the mask ends, making it 
obviously visible to the ones who use text base MUAs in fixed width font
terminals).

In other words, why doesnt the system produce an error for the second 
query as well???

> I'm sure you are aware that "1" is a set bit, so which part are you not 
> understanding?

Others (Marcus) have reported that the second query 
SELECT '255.255.255.255/25'::cidr;
indeed produces an error in 8.1;

so i guess its a bug in the 7.4.x series.

> 
> 

-- 
-Achilleus



Re: Feature, my misconception or bug??

From
Achilleus Mantzios
Date:
O Markus Schaber έγραψε στις Feb 22, 2006 :

> Achilleus Mantzios wrote:
> > In PgSQL 7.4.12,
> > 
> > foodb=# SELECT '255.255.255.255/24'::cidr;
> > ERROR:  invalid cidr value: "255.255.255.255/24"
> > DETAIL:  Value has bits set to right of mask.
> > foodb=# 
> > 
> > SELECT '255.255.255.255/25'::cidr;
> >         cidr
> > --------------------
> >  255.255.255.255/25
> > (1 row)
> 
> This one is refused in 8.1, so I guess that's a fixed bug.

Thanx Marcus,
it appears to have been fixed in

http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/network.c.diff?r1=1.53;r2=1.54;f=h

> 
> HTH,
> Markus
> 
> 
> 

-- 
-Achilleus