[PATCH] Don't truncate integer part in to_char for 'FM99.'

Marti Raudsepp <marti@juffo.org>

From: Marti Raudsepp <marti@juffo.org>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2011-09-07T17:40:18Z
Lists: pgsql-hackers

Attachments

Hi,

This patch fixes an edge case bug in the numeric to_char() function.

When the numeric to_char format used fillmode (FM), didn't contain 0s
and had a trailing dot, the integer part of the number was truncated in
error.

to_char(10, 'FM99.') used to return '1', after this patch it will return '10'

This is known to affect the format() function in the mysqlcompat
pgFoundry project.

Regards,
Marti