pg.ddx.io pgsql-odbc@postgresql.org mailing list archive
help / color / mirror / Atom feed'select count...' returns SQL_VARCHAR?
4+ messages / 3 participants
[nested] [flat]
* 'select count...' returns SQL_VARCHAR?
@ 2002-07-12 12:05 Stelios Sfakianakis <ssfak@ics.forth.gr>
2002-07-12 15:00 ` Re: 'select count...' returns SQL_VARCHAR? Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 4+ messages in thread
From: Stelios Sfakianakis @ 2002-07-12 12:05 UTC (permalink / raw)
To: 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
configuration:
- 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 <http://members.fortunecity.com/skuchin/home.htm;
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
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: 'select count...' returns SQL_VARCHAR?
2002-07-12 12:05 'select count...' returns SQL_VARCHAR? Stelios Sfakianakis <ssfak@ics.forth.gr>
@ 2002-07-12 15:00 ` Tom Lane <tgl@sss.pgh.pa.us>
2002-07-12 15:13 ` Re: 'select count...' returns SQL_VARCHAR? Stelios Sfakianakis <ssfak@ics.forth.gr>
2002-07-13 23:00 ` Re: 'select count...' returns SQL_VARCHAR? Hiroshi Inoue <Inoue@tpf.co.jp>
0 siblings, 2 replies; 4+ messages in thread
From: Tom Lane @ 2002-07-12 15:00 UTC (permalink / raw)
To: Stelios Sfakianakis <ssfak@ics.forth.gr>; +Cc: pgsql-odbc
Stelios Sfakianakis <ssfak@ics.forth.gr> writes:
> I am using the PostgreSQL and its ODBC driver but there seems to be
> some problem with the "select count(...)..." queries. Here is my
> configuration:
> - FreeBSD 4.6
> - PostgreSQL 7.2.1
count() returns bigint (int8) in 7.2. I seem to recall that ODBC has
some problem classifying bigint as numeric. I don't recall if that's
a simple bug or a standards compatibility issue. Anyway, the easiest
workaround may be to cast the result of count to integer (int4) so that
ODBC knows what to do with it.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: 'select count...' returns SQL_VARCHAR?
2002-07-12 12:05 'select count...' returns SQL_VARCHAR? Stelios Sfakianakis <ssfak@ics.forth.gr>
2002-07-12 15:00 ` Re: 'select count...' returns SQL_VARCHAR? Tom Lane <tgl@sss.pgh.pa.us>
@ 2002-07-12 15:13 ` Stelios Sfakianakis <ssfak@ics.forth.gr>
1 sibling, 0 replies; 4+ messages in thread
From: Stelios Sfakianakis @ 2002-07-12 15:13 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-odbc
Tom Lane wrote:
> Stelios Sfakianakis <ssfak@ics.forth.gr> writes:
>
>>I am using the PostgreSQL and its ODBC driver but there seems to be
>>some problem with the "select count(...)..." queries. Here is my
>>configuration:
>> - FreeBSD 4.6
>> - PostgreSQL 7.2.1
>
>
> count() returns bigint (int8) in 7.2. I seem to recall that ODBC has
> some problem classifying bigint as numeric. I don't recall if that's
> a simple bug or a standards compatibility issue. Anyway, the easiest
> workaround may be to cast the result of count to integer (int4) so that
> ODBC knows what to do with it.
>
> regards, tom lane
It works as expected, of course!
Thank you very much!
Best regards
Stelios Sfakianakis
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
--
"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
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: 'select count...' returns SQL_VARCHAR?
2002-07-12 12:05 'select count...' returns SQL_VARCHAR? Stelios Sfakianakis <ssfak@ics.forth.gr>
2002-07-12 15:00 ` Re: 'select count...' returns SQL_VARCHAR? Tom Lane <tgl@sss.pgh.pa.us>
@ 2002-07-13 23:00 ` Hiroshi Inoue <Inoue@tpf.co.jp>
1 sibling, 0 replies; 4+ messages in thread
From: Hiroshi Inoue @ 2002-07-13 23:00 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; Stelios Sfakianakis <ssfak@ics.forth.gr>; +Cc: pgsql-odbc
> -----Original Message-----
> From: Tom Lane
>
> Stelios Sfakianakis <ssfak@ics.forth.gr> writes:
> > I am using the PostgreSQL and its ODBC driver but there seems to be
> > some problem with the "select count(...)..." queries. Here is my
> > configuration:
> > - FreeBSD 4.6
> > - PostgreSQL 7.2.1
>
> count() returns bigint (int8) in 7.2. I seem to recall that ODBC has
> some problem classifying bigint as numeric. I don't recall if that's
> a simple bug or a standards compatibility issue.
It isn't a problem of the ODBC driver itself. The problem is if your
app (or the software you are using) can handle bigint properly.
Unfortunately there are some(many ?) softwares that can't
handle bigint properly and so the ODBC driver has returned
VARCHAR for int8 type. Recently I added the INT8 As (bigint,
numeric, double, ...) option to cope with this *sum(int4) returns
int8* problem.
regards,
Hiroshi Inoue
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2002-07-13 23:00 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-07-12 12:05 'select count...' returns SQL_VARCHAR? Stelios Sfakianakis <ssfak@ics.forth.gr>
2002-07-12 15:00 ` Tom Lane <tgl@sss.pgh.pa.us>
2002-07-12 15:13 ` Stelios Sfakianakis <ssfak@ics.forth.gr>
2002-07-13 23:00 ` Hiroshi Inoue <Inoue@tpf.co.jp>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox