Hi Michael,

 In my case, checking for integers is enough.

Thanks a lot for your answer though,

Alexandre

Michael Toews wrote:
"Numeric" is an ambiguous qualifier. This really depends on what you define as 
numeric: integers or reals. Furthermore, if you have negatives, or exponential notation, 
etc. I'd investigate into regular expressions in general (and also 
http://www.postgresql.org/docs/current/static/functions-matching.html).

If you want a floating point (and integer) regexp function, try instead:

CREATE OR REPLACE FUNCTION isnumeric(text)
  RETURNS boolean AS $BODY$SELECT $1 ~ 
E'^[-+]?\\d*\\.?\\d+(?:[eE][-+]?\\d+)?$'$BODY$
  LANGUAGE 'sql' IMMUTABLE;

(note: [eE] tests for numbers like '4.3e-32'; also IMMUTABLE is used to 
increase performance on large queries)

-Mike



--
Alexandre Dubé
Mapgears
www.mapgears.com

_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to