Dean Rasheed <dean.a.rasheed@gmail.com> writes:
> I don't really see the point of such a function either.
> Casting to numeric(1000, n) will work fine in all cases AFAICS (1000
> being the maximum allowed precision in a numeric typemod, and somewhat
> more memorable).
Right, but I think what the OP wants is to not have to think about
whether the input is of exact or inexact type. That's easily soluble
locally by making your own function:
create function round(float8, int) returns numeric
as $$select pg_catalog.round($1::pg_catalog.numeric, $2)$$
language sql strict immutable parallel safe;
but I'm not sure that the argument for it is strong enough to
justify putting it into Postgres.
> The fact that passing a negative scale to round() isn't documented
> does seem like an oversight though...
Agreed, will do something about that.
regards, tom lane