| From: | Michael Fuhr <mike(at)fuhr(dot)org> |
|---|---|
| To: | Jasbinder Singh Bali <jsbali(at)gmail(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: IP Address Validation |
| Date: | 2007-05-10 05:09:15 |
| Message-ID: | 20070510050915.GA31946@winnie.fuhr.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Thu, May 10, 2007 at 12:22:37AM -0400, Jasbinder Singh Bali wrote:
> I need to check whether the input string is in ip address format or not in
> one of my pl/pgsql functions.
> What function should be used to accomplish this
>
> I tried using
> if inet(strInput)
>
> However, it throws an exception if the input string is not in IP address
> format.
>
> I could have caught this exception but really don't know what type of
> exception category would this exception come under..
psql test
test=> \set VERBOSITY verbose
test=> select inet('junk');
ERROR: 22P02: invalid input syntax for type inet: "junk"
http://www.postgresql.org/docs/8.2/interactive/errcodes-appendix.html
22P02 INVALID TEXT REPRESENTATION invalid_text_representation
--
Michael Fuhr
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Naz Gassiep | 2007-05-10 05:47:48 | Re: In theory question |
| Previous Message | David Wall | 2007-05-10 04:30:44 | Re: Replication for PG 8 recommendations |