Re: inhibit rounding on numeric columns - Mailing list pgsql-sql

From Scott Marlowe
Subject Re: inhibit rounding on numeric columns
Date
Msg-id dcc563d10802142342m2f22721dtf6c109326908bd3d@mail.gmail.com
Whole thread Raw
In response to inhibit rounding on numeric columns  ("Horst Dehmer" <horst.dehmer@inode.at>)
List pgsql-sql
On Fri, Feb 15, 2008 at 1:28 AM, Horst Dehmer <horst.dehmer@inode.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.


pgsql-sql by date:

Previous
From: "Horst Dehmer"
Date:
Subject: inhibit rounding on numeric columns
Next
From: Niklas Johansson
Date:
Subject: Re: inhibit rounding on numeric columns