varchar, text and cidr - Mailing list pgsql-general

From Richard Welty
Subject varchar, text and cidr
Date
Msg-id E19jm8N-0002hj-97@skipper.averillpark.net
Whole thread Raw
Responses Re: varchar, text and cidr  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
so i'm trying to puzzle out how to do something in a client's database.
he's using postgresql 7.3.2 on a rh 8.0 system.

he has a column with type varchar(18) containing cidr blocks (yes, i know
he should use the cidr type, but he didn't.)

in my testing, i've determined that i can cast text to cidr, but i can't
cast varchar( limit) to cidr.

i've worked out that i can do this:

select * from vctest where '192.0.2.5'::cidr << baz::text::cidr;
     baz
--------------
 192.0.2.0/24

but is there any particular reason why i have to jump through the
typecasting hoop twice here?

thanks,
  richard
--
Richard Welty                                         rwelty@averillpark.net
Averill Park Networking                                         518-573-7592
    Java, PHP, PostgreSQL, Unix, Linux, IP Network Engineering, Security

pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: plPHP -- sort of an announcement.. but not commercial
Next
From: John Harrold
Date:
Subject: what is null