[postgis-users] isnumeric function
Alexandre Dube
adube at mapgears.com
Wed Jun 10 10:14:44 PDT 2009
Hi Paul,
Great. Thanks a lot for your help.
Kind regards,
Alexandre
Paul Ramsey wrote:
> As your link suggests, Alexandre, there is no such function, but it
> can be done w/ a regex pattern, which postgresql supports.
>
> pramsey=# CREATE FUNCTION isnumeric(text) RETURNS boolean AS 'SELECT
> $1 ~ ''^[0-9]+$'' ' LANGUAGE 'sql';
>
> pramsey=# select isnumeric('this');
> isnumeric
> -----------
> f
> (1 row)
>
> pramsey=# select isnumeric('34');
> isnumeric
> -----------
> t
> (1 row)
>
>
--
Alexandre Dubé
Mapgears
www.mapgears.com
More information about the postgis-users
mailing list