Re: varchar, text and cidr - Mailing list pgsql-general

From Richard Welty
Subject Re: varchar, text and cidr
Date
Msg-id E19jofI-0002rO-Kn@skipper.averillpark.net
Whole thread Raw
In response to Re: varchar, text and cidr  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: varchar, text and cidr
List pgsql-general
On Mon, 04 Aug 2003 18:07:49 -0400 Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Richard Welty <rwelty@averillpark.net> writes:
> > On Mon, 04 Aug 2003 16:58:29 -0400 Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >> Lack of an entry in pg_cast for varchar->cidr.  Feel free to create
> one.

> > if i knew how to determine the oid for a data type, i certainly would.

> You don't have to.  See CREATE CAST.

cool. although it does look like there's still a piece missing:

test=# create cast( varchar as cidr) with function cidr( text);
ERROR:  argument of cast function must match source data type
test=# create cast( varchar as cidr) with function cidr( varchar);
ERROR:  CreateCast: function cidr(character varying) does not exist

which i find interesting, since i can use the cidr funtion directly on
the varchar field:

test=#  select * from vctest where '192.0.2.5'::cidr << cidr( baz);
     baz
--------------
 192.0.2.0/24
(1 row)

note that i'm not in any big rush to deal with this, the cast-of-a-cast is
working ok at my customer's site.

oh well,
  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: Joseph Shraibman
Date:
Subject: Re: like performance w/o wildcards.
Next
From: Tom Lane
Date:
Subject: Re: like performance w/o wildcards.