inet/cidr wierdness (casting) - Mailing list pgsql-hackers

From Alex Pilosov
Subject inet/cidr wierdness (casting)
Date
Msg-id Pine.BSO.4.10.10106120955380.17529-100000@spider.pilosoft.com
Whole thread Raw
Responses Re: inet/cidr wierdness (casting)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
In case Tom isn't sick of me yet...

users=# select '10.1.2.3/24'::inet::cidr; ?column?   
-------------10.1.2.3/24

while:

users=# select '10.1.2.3/24'::cidr;
ERROR:  invalid CIDR value '10.1.2.3/24': has bits set to right of mask

Apparently, since there's no explicit function to cast from inet to cidr,
postgresql assumes its always safe to do so, as they are
binary-compatible. Anyone mind if I create explicit function for this so
this could be flagged as error?

-alex



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: AW: Implicit order-by in Postgresql?
Next
From: Zeugswetter Andreas SB
Date:
Subject: AW: AW: Postgres Replication