testing castability of VARCHAR data to INET/CIDR

From: Roman Neuhauser <neuhauser(at)sigpipe(dot)cz>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: testing castability of VARCHAR data to INET/CIDR
Date: 2005-07-23 09:31:23
Message-ID: 20050723093123.GA25329@isis.sigpipe.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I have a VARCHAR column containing mostly ip addresses, with an
occasional piece of junk, and would like to transfer this data to an
INET column. The UPDATE (SET inet_col = CAST(vc_col AS INET)) aborts
as soon as it hits an invalid datum. I'm looking for a way to add
something like WHERE IS_CASTABLE(vc_col, INET) to the update.
Is there anything ready to use? I don't see anything directly usable
in src/backend/utils/adt/network.c.

--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2005-07-23 12:04:55 Re: testing castability of VARCHAR data to INET/CIDR
Previous Message Jim C. Nasby 2005-07-22 23:13:58 Re: Wishlist?