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

'select count...' returns SQL_VARCHAR?

From: Stelios Sfakianakis <ssfak(at)ics(dot)forth(dot)gr>
To: pgsql-odbc(at)postgresql(dot)org
Subject: 'select count...' returns SQL_VARCHAR?
Date: 2002-07-12 12:05:04
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-odbc
Hello everyone,

I am using the PostgreSQL and its ODBC driver but there seems to be
some problem with the "select count(...)..." queries. Here is my
  - FreeBSD 4.6
  - PostgreSQL 7.2.1
  - PostgreSQL odbc driver 7.2.1
  - Driver Manager: iodbc 3.0.5 (and also tested with unixODBC 2.2.1
  and their pgsql odbc driver)
  - OTL <>

In my test case I just want to execute a simple "SELECT COUNT(*) FROM
test_tab" but the result is an OTL exception whenever I try to get the
count as an int. The error message is that the result of the query is
a VARCHAR and so I should use a char[] instead. (Indeed, extracting it
in a C string works and gives the correct result.)

I tried to track the error and I saw that inside the OTL the
SQLDescribeCol function is called for the specific query that returns
12 (SQL_VARCHAR) as the data type of the (single) 'count' column.

So is this a bug, a feature, or something else?
Do I miss something?

Best regards
Stelios Sfakianakis

"Right now, CORBA *is* the future of middleware. I'm not aware of any
other middleware that would come even close in portability, platform
support, features, performance, or multi-vendor support. It will be a
minimum of six or seven years before any other middleware platform
will be able to match that."
       --- Michi Henning in news:comp.object.corba, 28/06/2002


pgsql-odbc by date

Next:From: Tom LaneDate: 2002-07-12 15:00:38
Subject: Re: 'select count...' returns SQL_VARCHAR?
Previous:From: Dave PageDate: 2002-07-12 07:57:24
Subject: Re: [PATCHES] UI patch (Was: ODBC Patch to prevent setting of KSQO on 7.3+ servers)

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