Skip site navigation (1) Skip section navigation (2)

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

From: the6campbells <the6campbells(at)gmail(dot)com>
To: pgsql-odbc(at)postgresql(dot)org
Subject: sum(decimal) not returning dp when query run via ODBC on Linux
Date: 2010-01-17 16:03:12
Message-ID: 22431f1b1001170803h34084ea1tde619e5dbad112c4@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-odbc
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

Responses

pgsql-odbc by date

Next:From: the6campbellsDate: 2010-01-17 19:07:58
Subject: Linux SQLDriverConnectW fails but SQLDriverConnect works.
Previous:From: Laurent ChouinardDate: 2010-01-13 20:34:07
Subject: Re: C# w/ ODBC, 2.1 million list select gives empty DataSet

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group