Re: Cast to integer

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: Robert Osowiecki <robson(at)cavern(dot)pl>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Cast to integer
Date: 2005-10-05 13:48:49
Message-ID: BF695201.FDC5%sdavis2@mail.nih.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/5/05 9:08 AM, "Robert Osowiecki" <robson(at)cavern(dot)pl> 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message A. Kretschmer 2005-10-05 13:49:55 Re: Cast to integer
Previous Message L van der Walt 2005-10-05 13:36:06 Securing Postgres