monetrary prblem
От | Mahmoud Taghizadeh |
---|---|
Тема | monetrary prblem |
Дата | |
Msg-id | 20040822132429.38005.qmail@web50708.mail.yahoo.com обсуждение исходный текст |
Список | pgsql-patches |
My name : Mahmoud taghizade My email address : m_taghi@yahoo.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*** cash.c 2004-08-22 17:42:57.333775440 +0430 --- cash.c 2004-08-22 17:44:45.840279944 +0430 *************** *** 156,162 **** { /* we look for digits as int4 as we have less */ /* than the required number of decimal places */ ! if (isdigit((unsigned char) *s) && dec < fpoint ) { value = (value * 10) + *s - '0'; --- 156,162 ---- { /* we look for digits as int4 as we have less */ /* than the required number of decimal places */ ! if (isdigit((unsigned char) *s) && (dec < fpoint || fpoint == 0)) { value = (value * 10) + *s - '0';
В списке pgsql-patches по дате отправления: