Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 2A28F6330A8 for ; Fri, 11 Dec 2009 12:05:46 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 97796-03 for ; Fri, 11 Dec 2009 16:05:38 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from jupiter.marktest.pt (delta.marktest.pt [80.251.174.116]) by mail.postgresql.org (Postfix) with ESMTP id CC526632CE7 for ; Fri, 11 Dec 2009 12:05:37 -0400 (AST) Received: from Proteu (proteu.marktest.pt [10.61.90.54]) by jupiter.marktest.pt with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id 4R8T9CAL; Fri, 11 Dec 2009 16:05:35 -0000 Message-ID: From: "Oliveiros C," To: Subject: Is there any function to test for numeric ips? Date: Fri, 11 Dec 2009 16:05:34 -0000 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0CC6_01CA7A7B.C53F8180" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.739 tagged_above=-10 required=5 tests=BAYES_20=-0.74, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200912/37 X-Sequence-Number: 33475 This is a multi-part message in MIME format. ------=_NextPart_000_0CC6_01CA7A7B.C53F8180 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Dear All, I have a table with host names and some happen to be numeric IPs. I would like to be able to filter out the later. Is there any function pre-defined in the system that can test a = particular text type value to see if it is a numeric ip? Something that returns true if applied to '192.168.1.1' but false if = applied to 'videos.sapo.pt' ? I considered NOT LIKE '%.%.%.%' but I'm affraid it will filter out host = names like 'www.google.com.br' I've realized that, for ex, inet 'x.x.x.x' will fail if the input is not = a numeric IP,=20 is there any simple and direct way to somewhat trap that error and = convert it to a false value that can be used in a WHERE clause? This is not to be included in a program, I'm just interested in a query = that I can do directly to the back end on a client program like pgAdmin. I know very little ( nothing, actually...) about function creation in = pgplsql, so, before investing in learning, I would like to know if there = is any built in function that does the trick, so I can skip the = (potential) learning curve. So far, I've googled up and down but found none Thanx in advance for your kind and valuable help Best, Oliveiros ------=_NextPart_000_0CC6_01CA7A7B.C53F8180 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Dear All,
 
I have a table with host names and some = happen to=20 be numeric IPs.
 
I would like to be able to filter out = the=20 later.
 
Is there any function pre-defined in = the system=20 that can test a particular text type value to see if it is a numeric=20 ip?
 
Something that returns true if applied = to=20 '192.168.1.1' but false if applied to 'videos.sapo.pt' ?
 
I considered NOT LIKE '%.%.%.%' but I'm = affraid it=20 will filter out host names like 'www.google.com.br'
 
I've realized that, for ex, inet = 'x.x.x.x'=20 will fail if the input is not a numeric IP,
is there any simple and direct way = to somewhat=20 trap that error and convert it to a false value that can be = used
in a WHERE clause?
 
This is not to be included in a = program, I'm just=20 interested in a query that I can do directly to the back end on a client = program=20 like pgAdmin.
 
I know very little ( nothing, = actually...) about=20 function creation in pgplsql, so, before investing in learning, I would = like to=20 know if there is any built in function that does the trick, so I can = skip the=20 (potential) learning curve.
So far, I've googled up and down but = found=20 none
 
Thanx in advance for your kind and = valuable=20 help
 
Best,
Oliveiros
 
 
 
 
------=_NextPart_000_0CC6_01CA7A7B.C53F8180--