sum(decimal) not returning dp when query run via ODBC on Linux

sum(decimal) not returning dp when query run via ODBC on Linux

am 17.01.2010 17:03:12 von the6campbells

--001485f2d106b38681047d5e5f84
Content-Type: text/plain; charset=ISO-8859-1

query works fine via ODBC on Windows and via the SQL Gui on both Linux and
Windows against the same instance of Postgres 8.4 (running on Windows).

any suggestions?

postgres on linux
"PostgreSQL 8.4.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.6
20060404 (Red Hat 3.4.6-10), 32-bit"
postgres on windows
"PostgreSQL 8.4.1, compiled by Visual C++ build 1400, 32-bit"


CREATE TABLE tdec
(
rnum integer NOT NULL,
cdec numeric(7,2)
)

-1.00
0.00
1.00
0.10
10.00

using isql or an application using the ODBC driver

SQL> select sum (cdec) from tdec
+-------------+
| sum |
+-------------+
| 10 |
+-------------+
SQLRowCount returns 1
1 rows fetched
SQL> select * from tdec
+------------+----------+
| rnum | cdec |
+------------+----------+
| 0 | |
| 1 | -1 |
| 2 | 0 |
| 3 | 1 |
| 4 | 0 |
| 5 | 10 |
+------------+----------+

Doing a simple prepare and describe col

Out:
Column Name: sum
*Name Length Ptr: 3
*Data Type Ptr: SQL_NUMERIC (2)
*Column Size Ptr: 10
*Decimal Digits Ptr: 5
*Nullable Ptr: 1

odbc.ini

[PG84]
Description = PostgreSQL
Driver = psqlODBC
Database = test
Servername = remotebox
Username = test
Password = test123$
Port = 5432
Protocol = 7.4
ReadOnly = No
RowVersioning = No
ShowSystemTables = No
ShowOidColumn = No
FakeOidIndex = No

--001485f2d106b38681047d5e5f84
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

query works fine via ODBC on Windows and via the SQL Gui on both Linux and =
Windows against the same instance of Postgres 8.4 (running on Windows).
=

any suggestions?

postgres on linux
"PostgreSQL 8.4.2 on =
i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-=
10), 32-bit"

postgres on windows
"PostgreSQL 8.4.1, compiled by Visual C++ build=
1400, 32-bit"


CREATE TABLE tdec
(
=A0 rnum integer N=
OT NULL,
=A0 cdec numeric(7,2)
)

-1.00
0.00
1.00
0.10=


10.00

using isql or an application using the ODBC driver

SQL&=
gt; select sum (cdec) from tdec
+-------------+
| sum    =A0=
  =A0 |
+-------------+
| 10        =A0 |
+---=
----------+
SQLRowCount returns 1

1 rows fetched
SQL> select * from tdec
+------------+----------+<=
br>| rnum       | cdec     |
+------------+---------=
-+
| 0        =A0 |        =A0 |
| 1=
        =A0 | -1       |
| 2    =A0=
     | 0      =A0 |

| 3        =A0 | 1      =A0 |
| 4  =A0=
       | 0      =A0 |
| 5      =A0=
   | 10       |
+------------+----------+

Doing a=
simple prepare and describe col

=A0 Out:
  =A0 Column Name: =
sum
  =A0 *Name Length Ptr: 3

  =A0 *Data Type Ptr: SQL_NUMERIC (2)
  =A0 *Column Size Ptr: 10=

  =A0 *Decimal Digits Ptr: 5
  =A0 *Nullable Ptr: 1

o=
dbc.ini

[PG84]
Description             =
=3D PostgreSQL
Driver        =A0 =3D psqlODBC

Database              =A0 =3D test
Servernam=
e            =A0 =3D remotebox
Username  =
            =A0 =3D test
Password    =A0=
           =3D test123$
Port        =
  =A0 =3D 5432
Protocol              =A0=
=3D 7.4
ReadOnly              =A0 =3D No r>
RowVersioning           =3D No
ShowSystemTables=A0=
       =3D No
ShowOidColumn           =
=3D No
FakeOidIndex          =A0 =3D No




--001485f2d106b38681047d5e5f84--

Re: sum(decimal) not returning dp when query run via ODBCon Linux

am 18.01.2010 00:00:13 von Hiroshi Inoue

the6campbells wrote:
> query works fine via ODBC on Windows and via the SQL Gui on both Linux
> and Windows against the same instance of Postgres 8.4 (running on Windows).
>
> any suggestions?

Which version of psqlodbc driver are you using?
The recently released version (8.4.0200) will fix the problem.

regards,
Hiroshi Inoue

> postgres on linux
> "PostgreSQL 8.4.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.6
> 20060404 (Red Hat 3.4.6-10), 32-bit"
> postgres on windows
> "PostgreSQL 8.4.1, compiled by Visual C++ build 1400, 32-bit"
>
>
> CREATE TABLE tdec
> (
> rnum integer NOT NULL,
> cdec numeric(7,2)
> )
>
> -1.00
> 0.00
> 1.00
> 0.10
> 10.00
>
> using isql or an application using the ODBC driver
>
> SQL> select sum (cdec) from tdec
> +-------------+
> | sum |
> +-------------+
> | 10 |
> +-------------+
> SQLRowCount returns 1
> 1 rows fetched
> SQL> select * from tdec
> +------------+----------+
> | rnum | cdec |
> +------------+----------+
> | 0 | |
> | 1 | -1 |
> | 2 | 0 |
> | 3 | 1 |
> | 4 | 0 |
> | 5 | 10 |
> +------------+----------+
>
> Doing a simple prepare and describe col
>
> Out:
> Column Name: sum
> *Name Length Ptr: 3
> *Data Type Ptr: SQL_NUMERIC (2)
> *Column Size Ptr: 10
> *Decimal Digits Ptr: 5
> *Nullable Ptr: 1
>
> odbc.ini
>
> [PG84]
> Description = PostgreSQL
> Driver = psqlODBC
> Database = test
> Servername = remotebox
> Username = test
> Password = test123$
> Port = 5432
> Protocol = 7.4
> ReadOnly = No
> RowVersioning = No
> ShowSystemTables = No
> ShowOidColumn = No
> FakeOidIndex = No

--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc