On 25 January 2012 05:41, Pavel Stehule <[email protected]> wrote: > Hello > > 2012/1/25 raf <[email protected]>: >> hi, >> >> i just needed to round some numbers down to 4 decimal places but a quick >> search >> indicated that postgresql doesn't support all of the rounding methods so i >> had >> to write this dreadful function:
Are you talking about always rounding down to the lower smallest-possible-increment, rather than following standard rules for rounding? That isn't such an esoteric use case - I believe that financial regulations in some jurisdictions require just that when calculating interest, for example. If you require exactly 4 digits of precision, it's possible to use this syntax: NUMERIC(precision, scale) That isn't going to affect the rounding behaviour though. -- Peter Geoghegan http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training and Services -- Sent via pgsql-general mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
