Re: integer instead of 'double precision'?

From: Henry Drexler <alonup8tb(at)gmail(dot)com>
To: "Day, David" <dday(at)redcom(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: integer instead of 'double precision'?
Date: 2011-09-09 15:07:48
Message-ID: CAAtgU9R5DKkB9MRCRR2zKMpNg_J3bhuNS5aqvEnSsW5mVV2i4w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Perfect, thank you. I will try to find that in the documentation as I was
obviously not looking at the correct page I had linked to earlier.

On Fri, Sep 9, 2011 at 11:05 AM, Day, David <dday(at)redcom(dot)com> wrote:

> Henry,****
>
> ** **
>
> Does this suit your need?****
>
> ** **
>
> select 1/3::float as answer;****
>
> answer ****
>
> -------------------****
>
> 0.333333333333333****
>
> (1 row)****
>
> ** **
>
> *From:* pgsql-general-owner(at)postgresql(dot)org [mailto:
> pgsql-general-owner(at)postgresql(dot)org] *On Behalf Of *Henry Drexler
> *Sent:* Friday, September 09, 2011 10:42 AM
> *To:* pgsql-general(at)postgresql(dot)org
> *Subject:* [GENERAL] integer instead of 'double precision'?****
>
> ** **
>
> take any table and run****
>
> ** **
>
> Query****
>
> ---------------------****
>
> select****
>
> 1/3****
>
> from****
>
> storage****
>
> limit 1****
>
> ** **
>
> ** **
>
> Result****
>
> ---------------------****
>
> ?column?****
>
> integer****
>
> 0****
>
> ** **
>
> ** **
>
> Expected Result****
>
> ---------------------****
>
> ?column?****
>
> double precision****
>
> 0.33333...****
>
> ** **
>
> ** **
>
> ** **
>
> Question****
>
> ---------------------****
>
> Since there is no column type to begin with as this is a made-up column,
> shouldn't postgres know it is double precision due to the remainder?****
>
> ** **
>
> I thought perhaps I could cast it as double precision as noted on
> http://www.postgresql.org/docs/8.3/interactive/sql-expressions.html****
>
> ** **
>
> though doing the following:****
>
> ** **
>
> select****
>
> float8(1/3)****
>
> from****
>
> storage****
>
> limit 1****
>
> ** **
>
> results in:****
>
> ** **
>
> float8****
>
> double precision****
>
> 0****
>
> ** **
>
> ** **
>
> any ideas on how to get this type of a manufactured column (not sure the
> right term for it) to show the double precision result?****
>
> ** **
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Guillaume Lelarge 2011-09-09 15:09:58 Re: integer instead of 'double precision'?
Previous Message Henry Drexler 2011-09-09 14:42:11 integer instead of 'double precision'?