Re: inhibit rounding on numeric columns

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Horst Dehmer" <horst(dot)dehmer(at)inode(dot)at>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: inhibit rounding on numeric columns
Date: 2008-02-15 07:42:29
Message-ID: dcc563d10802142342m2f22721dtf6c109326908bd3d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, Feb 15, 2008 at 1:28 AM, Horst Dehmer <horst(dot)dehmer(at)inode(dot)at> wrote:
>
>
> Hi!
>
> Is there an easy way to enforce strict handling of numeric values with
> scales, i.e. raise an exception/error instead of rounding values to the
> specified scale?

I can't think of an easy way. But you can always make your own type I guess.

> Sadly, changing the schema is hardly a possibility for me :-(

Sadly, the people who have burdened you with this problem don't seem
to have fully understood the implications of rounding and the SQL
specification's take on when it happens.

Can you not even just make it wider? I mean, pgsql can change types
on the fly, and since the value's will fit in newer, wider numerics,
then you have an easy solution.

Anything else you do is going to far more invasive than changing the schema.

Or you'll have to handle all this in code somewhere.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Niklas Johansson 2008-02-15 07:46:08 Re: inhibit rounding on numeric columns
Previous Message Horst Dehmer 2008-02-15 07:28:41 inhibit rounding on numeric columns