monetary bug

Mahmoud Taghizadeh <m_taghi@yahoo.com>

From: Mahmoud Taghizadeh <m_taghi@yahoo.com>
To: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2004-08-22T11:50:33Z
Lists: pgsql-hackers
I found a little bug in monetary function of
postgresql function cash_in in file cash.c
the problem is that when I run 
set lc_monetary to "fa_IR.UTF8"
and try to insert a value to a field with type of
money, I got the following error:
"invalid input syntax for type money: "1000"

at the same time when I run "set lc_monetary to
"en_US.UTF8", everythings worked well.

I studied the source code and I found that cash.c has
a little problem to handling money type. I found that
this bug exists for all of countries that have not
precision for their money. 

I decided to write a patch for this bug, but before I
start my work, i want to know if anyone has any idea
about this bug or not?

a dirty method to fix this bug is to replace following
line 
if (isdigit((unsigned char) *s) && dec < fpoint )
with 
if (isdigit((unsigned char) *s) && ((dec < fpoint) ||
fpoint == 0))


M, Taghizade
Regards

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com