varchar, text and cidr

From: Richard Welty <rwelty(at)averillpark(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: varchar, text and cidr
Date: 2003-08-04 20:40:46
Message-ID: E19jm8N-0002hj-97@skipper.averillpark.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)averillpark(dot)net
Averill Park Networking 518-573-7592
Java, PHP, PostgreSQL, Unix, Linux, IP Network Engineering, Security

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-08-04 20:48:58 Re: plPHP -- sort of an announcement.. but not commercial
Previous Message Joshua D. Drake 2003-08-04 20:23:14 Re: plPHP -- sort of an announcement.. but not commercial