On Thu, Sep 5, 2013 at 8:53 PM, Alvaro Herrera <alvhe...@2ndquadrant.com>wrote:

> Greg Stark escribió:
>
> > The main difficulty is that Postgres is very extensible. So to implement
> > this you need to think bigger than NUMERIC. It should also be possible to
> > alter a column from varchar(5) to varchar(10) for example (but not the
> > other way around).
>
> We already allow that.  See commits
> 8f9fe6edce358f7904e0db119416b4d1080a83aa and
> 3cc0800829a6dda5347497337b0cf43848da4acf
>

Ah, nice. i missed that.

So the issue here is that NUMERIC has an additional concept of scale that
is buried in the values and that this scale is set based on the typmod that
was in effect when the value was stored. If you change the typmod on the
column it currently rescales all the values in the table? There's even a
comment to that effect on the commit you pointed at.

But I wonder if we could just declare that that's not what the scale typmod
does. That it's just a maximum scale but it's perfectly valid for NUMERIC
data with lower scales to be stored in a column than the typmod says. In a
way the current behaviour is like bpchar but it would be nice if it was
more like varchar


-- 
greg

Reply via email to