isnumeric(varchar) by psql

From: Emi Lu <emilu(at)encs(dot)concordia(dot)ca>
To: pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: isnumeric(varchar) by psql
Date: 2013-11-27 21:46:12
Message-ID: 52966824.8070404@encs.concordia.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello,

Does psql provide a function isnumeric(varchar) to check if a varchar
can be converted to a numeric field?

E.g.,
x | isnumeric
----------+-----------
| f
. | f
.0 | t
0. | t
0 | t
1 | t
123 | t
123.456 | t
abc | f
1..2 | f
1.2.3.4 | f
1x234 | f
1.234e-5 | t

Thanks a lot
Emi
--
Found examples users created by self. If psql provides similar one already?

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Venky Kandaswamy 2013-11-27 21:54:22 Re: isnumeric(varchar) by psql
Previous Message Marcin Krawczyk 2013-11-25 12:01:30 Re: tab delimiter in output