Обсуждение: Undesired decimal truncation with psqlodbc version 08.04.0100

Поиск
Список
Период
Сортировка

Undesired decimal truncation with psqlodbc version 08.04.0100

От
Marco Cassiano
Дата:
Hello everybody,
 
during this weekend we upgraded our Postgres database from version 8.3.8 to version 8.4.1.
We also updated the odbc driver from version 08.03.0400 to version 08.04.0100.
With this new version though, we observe an unwanted decimal truncation as you can see in the following example.
 
I would need your help to understand the reason of this different, undesired behavior and how to fix it.
 
Thank you
 
Marco
 
I attached the output from the same query on the same database made with the two drivers version:
 
 
>>>>> With version 08.03.0400 (Correct decimal handling, see column "co_perc_magg_matrice", first row):
 
SQL> select * from anamat.collezioni;
+-----+---------------------+-----------------+---------------------+--------------+---------+
| coll| co_descr            | co_coll_numerica| co_perc_magg_matrice| co_descr_abbr| cond_pag|
+-----+---------------------+-----------------+---------------------+--------------+---------+
| 1   | Descr. non disponib.| 10              | 1.200               | PennyPull    | RB10    |
| 2   | Descr. non disponib.| 20              | 0.000               | PennyBlack   |         |
| 3   | Descr. non disponib.| 30              | 0.000               | NewPenny     |         |
| 4   | Descr. non disponib.| 40              | 0.000               | Classic      | RB09    |
| 5   | Descr. non disponib.| 50              | 0.000               | PB Plus      |         |
| 6   | Descr. non disponib.| 60              | 0.000               | Active       |         |
| 7   | Descr. non disponib.| 70              | 0.000               | Jeans & B.   |         |
| 8   | Descr. non disponib.| 96              | 0.000               | Trend        |         |
| 9   | Descr. non disponib.| 90              | 0.000               | F. Natale    |         |
| A   | Descr. non disponib.| 48              | 0.000               |              | RB09    |
| B   | Descr. non disponib.| 31              | 0.000               | Flash NP S   | RB09    |
| C   | Descr. non disponib.| 32              | 0.000               | Flash NP C   | RB09    |
| E   | Descr. non disponib.| 11              | 0.000               | Ins.P.Pull   |         |
| F   | Descr. non disponib.| 21              | 0.000               | Flash PB J   | RB09    |
| G   | Descr. non disponib.| 22              | 0.000               | Flash PB G   | RB09    |
| H   | Descr. non disponib.| 35              | 0.000               | Ins.N.Penn   |         |
| I   | Descr. non disponib.| 23              | 0.000               | F. PB Ant.   | RB09    |
| K   | Descr. non disponib.| 28              | 0.000               | N.D.         |         |
| L   | Descr. non disponib.| 84              | 0.000               | FL           |         |
| M   | Descr. non disponib.| 24              | 0.000               | Flash PB M   | RB09    |
| N   | Descr. non disponib.| 85              | 0.000               | Ins. NP      | RB09    |
| O   | Descr. non disponib.| 26              | 0.000               | Saldi I. P   |         |
| P   | Descr. non disponib.| 98              | 0.000               | Pubblicit.   |         |
| R   | Descr. non disponib.| 99              | 0.000               | Prototipi    |         |
| S   | Descr. non disponib.| 25              | 0.000               | Ins. PB Ac   |         |
| T   | Descr. non disponib.| 45              | 0.000               | Fl. abiti    |         |
| U   | Descr. non disponib.| 46              | 0.000               | Chemises     |         |
| V   | Descr. non disponib.| 47              | 0.000               | Max&Co Acc   |         |
| W   | B2B by default      | 91              | 0.000               | B2B by def   |         |
| X   | Descr. non disponib.| 61              | 0.000               | Ins. MaxCo   |         |
| Y   | Descr. non disponib.| 27              | 0.000               | Idee reg.    |         |
| Z   | Descr. non disponib.| 49              | 0.000               | DD           |         |
+-----+---------------------+-----------------+---------------------+--------------+---------+
SQLRowCount returns 32
32 rows fetched
 
>>>>> With version 08.04.0100 (wrong decimal truncation):
 
SQL> select * from anamat.collezioni;
+-----+---------------------+-----------------+---------------------+--------------+---------+
| coll| co_descr            | co_coll_numerica| co_perc_magg_matrice| co_descr_abbr| cond_pag|
+-----+---------------------+-----------------+---------------------+--------------+---------+
| 1   | Descr. non disponib.| 10              | 1                   | PennyPull    | RB10    |
| 2   | Descr. non disponib.| 20              | 0                   | PennyBlack   |         |
| 3   | Descr. non disponib.| 30              | 0                   | NewPenny     |         |
| 4   | Descr. non disponib.| 40              | 0                   | Classic      | RB09    |
| 5   | Descr. non disponib.| 50              | 0                   | PB Plus      |         |
| 6   | Descr. non disponib.| 60              | 0                   | Active       |         |
| 7   | Descr. non disponib.| 70              | 0                   | Jeans & B.   |         |
| 8   | Descr. non disponib.| 96              | 0                   | Trend        |         |
| 9   | Descr. non disponib.| 90              | 0                   | F. Natale    |         |
| A   | Descr. non disponib.| 48              | 0                   |              | RB09    |
| B   | Descr. non disponib.| 31              | 0                   | Flash NP S   | RB09    |
| C   | Descr. non disponib.| 32              | 0                   | Flash NP C   | RB09    |
| E   | Descr. non disponib.| 11              | 0                   | Ins.P.Pull   |         |
| F   | Descr. non disponib.| 21              | 0                   | Flash PB J   | RB09    |
| G   | Descr. non disponib.| 22              | 0                   | Flash PB G   | RB09    |
| H   | Descr. non disponib.| 35              | 0                   | Ins.N.Penn   |         |
| I   | Descr. non disponib.| 23              | 0                   | F. PB Ant.   | RB09    |
| K   | Descr. non disponib.| 28              | 0                   | N.D.         |         |
| L   | Descr. non disponib.| 84              | 0                   | FL           |         |
| M   | Descr. non disponib.| 24              | 0                   | Flash PB M   | RB09    |
| N   | Descr. non disponib.| 85              | 0                   | Ins. NP      | RB09    |
| O   | Descr. non disponib.| 26              | 0                   | Saldi I. P   |         |
| P   | Descr. non disponib.| 98              | 0                   | Pubblicit.   |         |
| R   | Descr. non disponib.| 99              | 0                   | Prototipi    |         |
| S   | Descr. non disponib.| 25              | 0                   | Ins. PB Ac   |         |
| T   | Descr. non disponib.| 45              | 0                   | Fl. abiti    |         |
| U   | Descr. non disponib.| 46              | 0                   | Chemises     |         |
| V   | Descr. non disponib.| 47              | 0                   | Max&Co Acc   |         |
| W   | B2B by default      | 91              | 0                   | B2B by def   |         |
| X   | Descr. non disponib.| 61              | 0                   | Ins. MaxCo   |         |
| Y   | Descr. non disponib.| 27              | 0                   | Idee reg.    |         |
| Z   | Descr. non disponib.| 49              | 0                   | DD           |         |
+-----+---------------------+-----------------+---------------------+--------------+---------+
SQLRowCount returns 32
32 rows fetched




Re: Undesired decimal truncation with psqlodbc version 08.04.0100

От
Hiroshi Inoue
Дата:
Hi Marco,

Marco Cassiano wrote:
> Hello everybody,
>
> during this weekend we upgraded our Postgres database from version 8.3.8
> to version 8.4.1.
> We also updated the odbc driver from version 08.03.0400 to version
> 08.04.0100.
> With this new version though, we observe an unwanted decimal truncation
> as you can see in the following example.
>
> I would need your help to understand the reason of this different,
> undesired behavior and how to fix it.

Please apply the attached patch.

regards,
Hiroshi Inoue

> Thank you
>
> Marco
>
> I attached the output from the same query on the same database made with
> the two drivers version:
>
>
>> >>>> With version 08.03.0400 (Correct decimal handling, see column
> "co_perc_magg_matrice", first row):
>
> SQL> select * from anamat.collezioni;
> +-----+---------------------+-----------------+---------------------+--------------+---------+
> | coll| co_descr            | co_coll_numerica| co_perc_magg_matrice|
> co_descr_abbr| cond_pag|
> +-----+---------------------+-----------------+---------------------+--------------+---------+
> | 1   | Descr. non disponib.| 10              | 1.200               |
> PennyPull    | RB10    |
> | 2   | Descr. non disponib.| 20              | 0.000               |
> PennyBlack   |         |
> | 3   | Descr. non disponib.| 30              | 0.000               |
> NewPenny     |         |
> | 4   | Descr. non disponib.| 40              | 0.000               |
> Classic      | RB09    |
> | 5   | Descr. non disponib.| 50              | 0.000               | PB
> Plus      |         |
> | 6   | Descr. non disponib.| 60              | 0.000               |
> Active       |         |
> | 7   | Descr. non disponib.| 70              | 0.000               |
> Jeans & B.   |         |
> | 8   | Descr. non disponib.| 96              | 0.000               |
> Trend        |         |
> | 9   | Descr. non disponib.| 90              | 0.000               | F.
> Natale    |         |
> | A   | Descr. non disponib.| 48              | 0.000
> |              | RB09    |
> | B   | Descr. non disponib.| 31              | 0.000               |
> Flash NP S   | RB09    |
> | C   | Descr. non disponib.| 32              | 0.000               |
> Flash NP C   | RB09    |
> | E   | Descr. non disponib.| 11              | 0.000               |
> Ins.P.Pull   |         |
> | F   | Descr. non disponib.| 21              | 0.000               |
> Flash PB J   | RB09    |
> | G   | Descr. non disponib.| 22              | 0.000               |
> Flash PB G   | RB09    |
> | H   | Descr. non disponib.| 35              | 0.000               |
> Ins.N.Penn   |         |
> | I   | Descr. non disponib.| 23              | 0.000               | F.
> PB Ant.   | RB09    |
> | K   | Descr. non disponib.| 28              | 0.000               |
> N.D.         |         |
> | L   | Descr. non disponib.| 84              | 0.000               |
> FL           |         |
> | M   | Descr. non disponib.| 24              | 0.000               |
> Flash PB M   | RB09    |
> | N   | Descr. non disponib.| 85              | 0.000               |
> Ins. NP      | RB09    |
> | O   | Descr. non disponib.| 26              | 0.000               |
> Saldi I. P   |         |
> | P   | Descr. non disponib.| 98              | 0.000               |
> Pubblicit.   |         |
> | R   | Descr. non disponib.| 99              | 0.000               |
> Prototipi    |         |
> | S   | Descr. non disponib.| 25              | 0.000               |
> Ins. PB Ac   |         |
> | T   | Descr. non disponib.| 45              | 0.000               |
> Fl. abiti    |         |
> | U   | Descr. non disponib.| 46              | 0.000               |
> Chemises     |         |
> | V   | Descr. non disponib.| 47              | 0.000               |
> Max&Co Acc   |         |
> | W   | B2B by default      | 91              | 0.000               |
> B2B by def   |         |
> | X   | Descr. non disponib.| 61              | 0.000               |
> Ins. MaxCo   |         |
> | Y   | Descr. non disponib.| 27              | 0.000               |
> Idee reg.    |         |
> | Z   | Descr. non disponib.| 49              | 0.000               |
> DD           |         |
> +-----+---------------------+-----------------+---------------------+--------------+---------+
> SQLRowCount returns 32
> 32 rows fetched
>
>> >>>> With version 08.04.0100 (wrong decimal truncation):
>
> SQL> select * from anamat.collezioni;
> +-----+---------------------+-----------------+---------------------+--------------+---------+
> | coll| co_descr            | co_coll_numerica| co_perc_magg_matrice|
> co_descr_abbr| cond_pag|
> +-----+---------------------+-----------------+---------------------+--------------+---------+
> | 1   | Descr. non disponib.| 10              | 1                   |
> PennyPull    | RB10    |
> | 2   | Descr. non disponib.| 20              | 0                   |
> PennyBlack   |         |
> | 3   | Descr. non disponib.| 30              | 0                   |
> NewPenny     |         |
> | 4   | Descr. non disponib.| 40              | 0                   |
> Classic      | RB09    |
> | 5   | Descr. non disponib.| 50              | 0                   | PB
> Plus      |         |
> | 6   | Descr. non disponib.| 60              | 0                   |
> Active       |         |
> | 7   | Descr. non disponib.| 70              | 0                   |
> Jeans & B.   |         |
> | 8   | Descr. non disponib.| 96              | 0                   |
> Trend        |         |
> | 9   | Descr. non disponib.| 90              | 0                   | F.
> Natale    |         |
> | A   | Descr. non disponib.| 48              | 0
> |              | RB09    |
> | B   | Descr. non disponib.| 31              | 0                   |
> Flash NP S   | RB09    |
> | C   | Descr. non disponib.| 32              | 0                   |
> Flash NP C   | RB09    |
> | E   | Descr. non disponib.| 11              | 0                   |
> Ins.P.Pull   |         |
> | F   | Descr. non disponib.| 21              | 0                   |
> Flash PB J   | RB09    |
> | G   | Descr. non disponib.| 22              | 0                   |
> Flash PB G   | RB09    |
> | H   | Descr. non disponib.| 35              | 0                   |
> Ins.N.Penn   |         |
> | I   | Descr. non disponib.| 23              | 0                   | F.
> PB Ant.   | RB09    |
> | K   | Descr. non disponib.| 28              | 0                   |
> N.D.         |         |
> | L   | Descr. non disponib.| 84              | 0                   |
> FL           |         |
> | M   | Descr. non disponib.| 24              | 0                   |
> Flash PB M   | RB09    |
> | N   | Descr. non disponib.| 85              | 0                   |
> Ins. NP      | RB09    |
> | O   | Descr. non disponib.| 26              | 0                   |
> Saldi I. P   |         |
> | P   | Descr. non disponib.| 98              | 0                   |
> Pubblicit.   |         |
> | R   | Descr. non disponib.| 99              | 0                   |
> Prototipi    |         |
> | S   | Descr. non disponib.| 25              | 0                   |
> Ins. PB Ac   |         |
> | T   | Descr. non disponib.| 45              | 0                   |
> Fl. abiti    |         |
> | U   | Descr. non disponib.| 46              | 0                   |
> Chemises     |         |
> | V   | Descr. non disponib.| 47              | 0                   |
> Max&Co Acc   |         |
> | W   | B2B by default      | 91              | 0                   |
> B2B by def   |         |
> | X   | Descr. non disponib.| 61              | 0                   |
> Ins. MaxCo   |         |
> | Y   | Descr. non disponib.| 27              | 0                   |
> Idee reg.    |         |
> | Z   | Descr. non disponib.| 49              | 0                   |
> DD           |         |
> +-----+---------------------+-----------------+---------------------+--------------+---------+
> SQLRowCount returns 32
> 32 rows fetched

*** convert.c    Wed Nov 18 01:11:06 2009
--- ../ver_8040100/convert.c    Tue Nov 17 23:59:08 2009
***************
*** 1099,1105 ****
                              for (i = 0, j = 0; ptr[i]; i++)
                                  if (ptr[i] == '.')
                                  {
!                                     strncpy_null(&new_string[j], lc->decimal_point, strlen(lc->decimal_point));
                                      j += strlen(lc->decimal_point);
                                  }
                                  else
--- 1099,1105 ----
                              for (i = 0, j = 0; ptr[i]; i++)
                                  if (ptr[i] == '.')
                                  {
!                                     strncpy_null(&new_string[j], lc->decimal_point, cbValueMax - j);
                                      j += strlen(lc->decimal_point);
                                  }
                                  else

Re: Undesired decimal truncation with psqlodbc version 08.04.0100

От
"Cassiano, Marco"
Дата:
Hi Hiroshi,

I applied the patch and now I have the correct behaviour.
Thank you very much
Regards


Marco

---------------------------------------------------------------------------------------------


-----Original Message-----
From: Hiroshi Inoue [mailto:inoue@tpf.co.jp]
Sent: Tuesday, November 17, 2009 5:17 PM
To: Cassiano, Marco
Cc: pgsql-odbc@postgresql.org
Subject: Re: [ODBC] Undesired decimal truncation with psqlodbc version 08.04.0100

Hi Marco,

Marco Cassiano wrote:
> Hello everybody,
>
> during this weekend we upgraded our Postgres database from version 8.3.8
> to version 8.4.1.
> We also updated the odbc driver from version 08.03.0400 to version
> 08.04.0100.
> With this new version though, we observe an unwanted decimal truncation
> as you can see in the following example.
>
> I would need your help to understand the reason of this different,
> undesired behavior and how to fix it.

Please apply the attached patch.

regards,
Hiroshi Inoue

> Thank you
>
> Marco
>
> I attached the output from the same query on the same database made with
> the two drivers version:
>
>
>> >>>> With version 08.03.0400 (Correct decimal handling, see column
> "co_perc_magg_matrice", first row):
>
> SQL> select * from anamat.collezioni;
> +-----+---------------------+-----------------+---------------------+--------------+---------+
> | coll| co_descr            | co_coll_numerica| co_perc_magg_matrice|
> co_descr_abbr| cond_pag|
> +-----+---------------------+-----------------+---------------------+--------------+---------+
> | 1   | Descr. non disponib.| 10              | 1.200               |
> PennyPull    | RB10    |
> | 2   | Descr. non disponib.| 20              | 0.000               |
> PennyBlack   |         |
> | 3   | Descr. non disponib.| 30              | 0.000               |
> NewPenny     |         |
> | 4   | Descr. non disponib.| 40              | 0.000               |
> Classic      | RB09    |
> | 5   | Descr. non disponib.| 50              | 0.000               | PB
> Plus      |         |
> | 6   | Descr. non disponib.| 60              | 0.000               |
> Active       |         |
> | 7   | Descr. non disponib.| 70              | 0.000               |
> Jeans & B.   |         |
> | 8   | Descr. non disponib.| 96              | 0.000               |
> Trend        |         |
> | 9   | Descr. non disponib.| 90              | 0.000               | F.
> Natale    |         |
> | A   | Descr. non disponib.| 48              | 0.000
> |              | RB09    |
> | B   | Descr. non disponib.| 31              | 0.000               |
> Flash NP S   | RB09    |
> | C   | Descr. non disponib.| 32              | 0.000               |
> Flash NP C   | RB09    |
> | E   | Descr. non disponib.| 11              | 0.000               |
> Ins.P.Pull   |         |
> | F   | Descr. non disponib.| 21              | 0.000               |
> Flash PB J   | RB09    |
> | G   | Descr. non disponib.| 22              | 0.000               |
> Flash PB G   | RB09    |
> | H   | Descr. non disponib.| 35              | 0.000               |
> Ins.N.Penn   |         |
> | I   | Descr. non disponib.| 23              | 0.000               | F.
> PB Ant.   | RB09    |
> | K   | Descr. non disponib.| 28              | 0.000               |
> N.D.         |         |
> | L   | Descr. non disponib.| 84              | 0.000               |
> FL           |         |
> | M   | Descr. non disponib.| 24              | 0.000               |
> Flash PB M   | RB09    |
> | N   | Descr. non disponib.| 85              | 0.000               |
> Ins. NP      | RB09    |
> | O   | Descr. non disponib.| 26              | 0.000               |
> Saldi I. P   |         |
> | P   | Descr. non disponib.| 98              | 0.000               |
> Pubblicit.   |         |
> | R   | Descr. non disponib.| 99              | 0.000               |
> Prototipi    |         |
> | S   | Descr. non disponib.| 25              | 0.000               |
> Ins. PB Ac   |         |
> | T   | Descr. non disponib.| 45              | 0.000               |
> Fl. abiti    |         |
> | U   | Descr. non disponib.| 46              | 0.000               |
> Chemises     |         |
> | V   | Descr. non disponib.| 47              | 0.000               |
> Max&Co Acc   |         |
> | W   | B2B by default      | 91              | 0.000               |
> B2B by def   |         |
> | X   | Descr. non disponib.| 61              | 0.000               |
> Ins. MaxCo   |         |
> | Y   | Descr. non disponib.| 27              | 0.000               |
> Idee reg.    |         |
> | Z   | Descr. non disponib.| 49              | 0.000               |
> DD           |         |
> +-----+---------------------+-----------------+---------------------+--------------+---------+
> SQLRowCount returns 32
> 32 rows fetched
>
>> >>>> With version 08.04.0100 (wrong decimal truncation):
>
> SQL> select * from anamat.collezioni;
> +-----+---------------------+-----------------+---------------------+--------------+---------+
> | coll| co_descr            | co_coll_numerica| co_perc_magg_matrice|
> co_descr_abbr| cond_pag|
> +-----+---------------------+-----------------+---------------------+--------------+---------+
> | 1   | Descr. non disponib.| 10              | 1                   |
> PennyPull    | RB10    |
> | 2   | Descr. non disponib.| 20              | 0                   |
> PennyBlack   |         |
> | 3   | Descr. non disponib.| 30              | 0                   |
> NewPenny     |         |
> | 4   | Descr. non disponib.| 40              | 0                   |
> Classic      | RB09    |
> | 5   | Descr. non disponib.| 50              | 0                   | PB
> Plus      |         |
> | 6   | Descr. non disponib.| 60              | 0                   |
> Active       |         |
> | 7   | Descr. non disponib.| 70              | 0                   |
> Jeans & B.   |         |
> | 8   | Descr. non disponib.| 96              | 0                   |
> Trend        |         |
> | 9   | Descr. non disponib.| 90              | 0                   | F.
> Natale    |         |
> | A   | Descr. non disponib.| 48              | 0
> |              | RB09    |
> | B   | Descr. non disponib.| 31              | 0                   |
> Flash NP S   | RB09    |
> | C   | Descr. non disponib.| 32              | 0                   |
> Flash NP C   | RB09    |
> | E   | Descr. non disponib.| 11              | 0                   |
> Ins.P.Pull   |         |
> | F   | Descr. non disponib.| 21              | 0                   |
> Flash PB J   | RB09    |
> | G   | Descr. non disponib.| 22              | 0                   |
> Flash PB G   | RB09    |
> | H   | Descr. non disponib.| 35              | 0                   |
> Ins.N.Penn   |         |
> | I   | Descr. non disponib.| 23              | 0                   | F.
> PB Ant.   | RB09    |
> | K   | Descr. non disponib.| 28              | 0                   |
> N.D.         |         |
> | L   | Descr. non disponib.| 84              | 0                   |
> FL           |         |
> | M   | Descr. non disponib.| 24              | 0                   |
> Flash PB M   | RB09    |
> | N   | Descr. non disponib.| 85              | 0                   |
> Ins. NP      | RB09    |
> | O   | Descr. non disponib.| 26              | 0                   |
> Saldi I. P   |         |
> | P   | Descr. non disponib.| 98              | 0                   |
> Pubblicit.   |         |
> | R   | Descr. non disponib.| 99              | 0                   |
> Prototipi    |         |
> | S   | Descr. non disponib.| 25              | 0                   |
> Ins. PB Ac   |         |
> | T   | Descr. non disponib.| 45              | 0                   |
> Fl. abiti    |         |
> | U   | Descr. non disponib.| 46              | 0                   |
> Chemises     |         |
> | V   | Descr. non disponib.| 47              | 0                   |
> Max&Co Acc   |         |
> | W   | B2B by default      | 91              | 0                   |
> B2B by def   |         |
> | X   | Descr. non disponib.| 61              | 0                   |
> Ins. MaxCo   |         |
> | Y   | Descr. non disponib.| 27              | 0                   |
> Idee reg.    |         |
> | Z   | Descr. non disponib.| 49              | 0                   |
> DD           |         |
> +-----+---------------------+-----------------+---------------------+--------------+---------+
> SQLRowCount returns 32
> 32 rows fetched