Paul Vixie <[EMAIL PROTECTED]> writes:
> lartomatic=# select (host(relay)||'/18')::cidr from spam limit 5;
> ERROR:  Cannot cast type 'text' to 'cidr'
> lartomatic=# select (host(relay)||'/18')::inet from spam limit 5;
> ERROR:  Cannot cast type 'text' to 'inet'

Your wish is our command ;-).  It seems to work okay in 7.2 beta:

regression=# create table spam(relay inet);
CREATE
regression=# insert into spam values ('127.0.0.1');
INSERT 287658 1
regression=# select (host(relay)||'/18')::cidr from spam limit 5;
ERROR:  invalid CIDR value '127.0.0.1/18': has bits set to right of mask
regression=# select (host(relay)||'/18')::inet from spam limit 5;
     inet
--------------
 127.0.0.1/18
(1 row)

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply via email to