Re: Native type for storing fractions (e.g 1/3)?

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Cc: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>, Ken Johanson <pg-user(at)kensystem(dot)com>
Subject: Re: Native type for storing fractions (e.g 1/3)?
Date: 2007-03-15 06:41:18
Message-ID: 200703150741.19300.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ron Johnson wrote:
> On 03/14/07 18:55, Ken Johanson wrote:
> > In SQL servers in general, or in PG, is there a native field type
> > to store fractions? Or must one resort to char or separate
> > numerator/denominator columns?
>
> 1/3 repeats ad infinitum, and '1/3' would have to be converted to
> 0.3333333333 before used in a computation, so:
>
> What's your ultimate purpose or goal?

His goal may be to store and compute rational numbers exactly. The
answer is that there is no data type in PostgreSQL that supports this.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ashley Moran 2007-03-15 09:35:44 Re: How to write a function that manipulates a set of results
Previous Message Tom Lane 2007-03-15 06:38:22 Re: Lifecycle of PostgreSQL releases