monetrary prblem

From: Mahmoud Taghizadeh <m_taghi(at)yahoo(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: monetrary prblem
Date: 2004-08-22 13:24:29
Message-ID: 20040822132429.38005.qmail@web50708.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

My name : Mahmoud taghizade
My email address : m_taghi(at)yahoo(dot)com

System Configuration
---------------------
Architecture (example: Intel Pentium) :
Intel Pentium

Operating System (example: Linux 2.4.18) :Linux
2.6.5-1.358 (Fedora core 2)

PostgreSQL version (example: PostgreSQL-7.4.3):
PostgreSQL-7.4.3

Compiler used (example: gcc 2.95.2) : I
used rpm version

Please enter a FULL description of your problem:
------------------------------------------------
when I set lc_monetary to fa_IR.UTF8 and try to insert
a value for field whose type is money I got
following error:

invalid input syntax for type money: "10"
I study the cash.c and found that the problem exists
for any monetary that has not precision.
fa_IR, tr_TR and ...

Please describe a way to repeat the problem. Please
try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

create a table with a money type:

CREATE TABLE test ( m money);

and then set lc_monetary to fa_IR.UTF8
now try to insert a value
INSERT INTO test VALUES ('10');

you will get the error message.

now if you set lc_monetary to en_UR.UTF8 (or any
monetary that has precision) you can run the

INSERT INTO test VALUES ('10');

without any error.

If you know how this problem might be fixed, list the
solution below:
---------------------------------------------------------------------

I have a dirty method to fix the problem, replace the
line 159 in backend/utils/adt/cash.c
if (isdigit((unsigned char) *s) && dec < fpoint)

with

if (isdigit((unsigned char) *s) && (dec < fpoint ||
fpoint == 0))

because the prolem only exists for monetrat with
fpoint == 0;

apply patch:

cp cash.diff to src/backend/utils/adt/ directory
and then patch -p0 < cash.c
now recompile the postgreSQL, the problem will be
fixed.


__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

Attachment Content-Type Size
cash.diff text/x-patch 586 bytes

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2004-08-22 16:52:18 Re: pg_hba.conf and IP-MASK
Previous Message Andrew Dunstan 2004-08-22 08:44:57 Re: pg_hba.conf and IP-MASK