Search Postgresql Archives

Re: Cast double precision to integer & check for overflow

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

 



On 01/26/2013 03:09 PM, Ian Pilcher wrote:
On 01/26/2013 05:06 PM, Alexander Gataric wrote:
Just cast to integer. Decimal portion will be lost.

That part I've got.  :-)

It's checking that the double precision value will actual fit within the
range of the integer type (-2147483648 to +2147483647).  I could
certainly hard-code these values, but I'd like to use a more expressive
syntax, if it is available.


http://www.postgresql.org/docs/9.2/interactive/catalog-pg-type.html

production=# SELECT typname,typlen from pg_type where typname ='int8';
-[ RECORD 1 ]-
typname | int8
typlen  | 8



--
Adrian Klaver
adrian.klaver@xxxxxxxxx


--
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