Re: varchar, text and cidr

From: Richard Welty <rwelty(at)averillpark(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: varchar, text and cidr
Date: 2003-08-04 23:22:56
Message-ID: E19jofI-0002rO-Kn@skipper.averillpark.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 04 Aug 2003 18:07:49 -0400 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Richard Welty <rwelty(at)averillpark(dot)net> writes:
> > On Mon, 04 Aug 2003 16:58:29 -0400 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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(at)averillpark(dot)net
Averill Park Networking 518-573-7592
Java, PHP, PostgreSQL, Unix, Linux, IP Network Engineering, Security

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-08-05 00:05:37 Re: like performance w/o wildcards.
Previous Message Joseph Shraibman 2003-08-04 23:20:52 Re: like performance w/o wildcards.