Search Postgresql Archives

Re: Cast to integer

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

 



On 10/5/05 9:08 AM, "Robert Osowiecki" <robson@xxxxxxxxx> wrote:

> Hello!
> 
> Anyone could explain to me, why cast(3.33 to int) works (from float, I
> suppose)  but cast('3.33' to int) (from text) does not? And what if I
> create a cast for that: is it possibly dangerous?

How about:

sdavis=# select (('3.33')::float)::int;
 int4 
------
    3
(1 row)

Sean


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

[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