Search Postgresql Archives

Re: How can I tell, in a trigger, if a value in a string is an integer.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Philip W. Dalrymple napisal 29.10.2008 15:26:

 set_config('session.sessionid','23',false);

I validate strings with regexp. This expression returns true:

select '23' ~'^-{0,1}[0-9]+$';

If it's true - you can cast it safely:
select cast('23' as integer)

--
Regards,
Tomasz Myrta

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux