Re: [HACKERS] Re: [HACKERS] Re: [HACKERS] Re: [HACKERS] Is it necessary to rewrite table while increasing the scale of datatype numeric? - Mailing list pgsql-hackers

From Jeff Janes
Subject Re: [HACKERS] Re: [HACKERS] Re: [HACKERS] Re: [HACKERS] Is it necessary to rewrite table while increasing the scale of datatype numeric?
Date
Msg-id CAMkU=1w5qMi7KF9DdAokvjKpMDYHRKgQm2D93aJGphgMxUw-xA@mail.gmail.com
Whole thread Raw
In response to Re: Re: [HACKERS] Re: [HACKERS] Re: [HACKERS] Is it necessary to rewrite table while increasing the scale of datatype numeric?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Re: [HACKERS] Re: [HACKERS] Re: [HACKERS] Is it necessary to rewrite table while increasing the scale of datatype numeric?
List pgsql-hackers
On Fri, Sep 6, 2013 at 11:47 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Robert Haas <robertmhaas@gmail.com> writes:
> Sure, but the point is that 5.0000 is not the same as 5.000 today.  If
> you start whacking this around you'll be changing that behavior, I
> think.

Yeah.  And please note that no matter what the OP may think, a lot of
people *do* consider that there's a useful distinction between 5.000
and 5.0000 --- it might indicate the number of significant digits in
a measurement, for example.  I do not see us abandoning that just to make
certain cases of ALTER TABLE faster.

But note that the current behavior is worse in this regard.  If you specify a scale of 4 at the column level, than it is not possible to distinguish between 5.000 and 5.0000 on a per-value basis within that column.  If the scale at the column level was taken as the maximum scale, not the only allowed one, then that distinction could be recorded. That behavior seems more sensible to me (metrologically speaking, regardless of alter table performance aspects), but I don't see how to get there from here with acceptable compatibility breakage.  

My lesson from going over this thread is, just use numeric, not numeric(x,y), unless you are storing currency or need compatibility with a different database system (in which case, good luck with that).

Cheers,

Jeff

pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Where to load modules from?
Next
From: Hannu Krosing
Date:
Subject: Re: record identical operator