Обсуждение: Aggregate function problem in VB6
Hi,
I have encountered a problem with following query run over ODBC in MS VS 6.0
SP5 in DataEnvironment designer:
"SELECT SUM(field1) FROM table1;"
field 1 is of type INT4.
There is "E_FAIL" error message.
I use:
PostgreSQL 7.1 on OpenBSD 2.9
ODBC PostgreSQL 7.01.0005
MS Visual Studio 6.0 SP 5
MS ActiveX Data Objects 2.6 Library
Microsoft OLE DB Provider for ODBC Driver
Other aggregate functions work ok.
Thanks
Przemek Wieclawek.
"Sekcja Informatyki Medycznej" <informatyka@cskmswia.pl> writes:
> I have encountered a problem with following query run over ODBC in MS VS 6.0
> SP5 in DataEnvironment designer:
> "SELECT SUM(field1) FROM table1;"
> field 1 is of type INT4.
> There is "E_FAIL" error message.
SUM() of int4 yields type NUMERIC these days. Perhaps MS VS doesn't
know what that is, or perhaps our ODBC driver doesn't handle it well.
A possible workaround is to cast the result back to int4, but that
just re-exposes you to the overflow risk we were trying to eliminate...
regards, tom lane
Sekcja Informatyki Medycznej wrote: > > Hi, > I have encountered a problem with following query run over ODBC in MS VS 6.0 > SP5 in DataEnvironment designer: > > "SELECT SUM(field1) FROM table1;" > field 1 is of type INT4. > > There is "E_FAIL" error message. > Could you see the server-side log ? Try running the postmaster with -d2 (and without -S) and see what gets logged in its stderr output. regards, Hiroshi Inoue
Hi, This is Postgres logfile: DEBUG: StartTransactionCommand DEBUG: query: SELECT SUM(field) FROM table DEBUG: ProcessQuery DEBUG: CommitTransactionCommand Log seems ok to me but still SUM() doesn't work on VB side. Regards, Przemek Wieclawek ----- Original Message ----- From: Hiroshi Inoue <Inoue@tpf.co.jp> To: Sekcja Informatyki Medycznej <informatyka@cskmswia.pl> Cc: pgsql-odbc <pgsql-odbc@postgresql.org> Sent: Friday, June 01, 2001 4:16 AM Subject: Re: [ODBC] Aggregate function problem in VB6 > Sekcja Informatyki Medycznej wrote: > > > > Hi, > > I have encountered a problem with following query run over ODBC in MS VS 6.0 > > SP5 in DataEnvironment designer: > > > > "SELECT SUM(field1) FROM table1;" > > field 1 is of type INT4. > > > > There is "E_FAIL" error message. > > > > Could you see the server-side log ? > Try running the postmaster with -d2 (and without -S) > and see what gets logged in its stderr output. > > regards, > Hiroshi Inoue > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster >
> -----Original Message----- > From: Sekcja Informatyki Medycznej [mailto:informatyka@cskmswia.pl] > > Hi, > This is Postgres logfile: > > DEBUG: StartTransactionCommand > DEBUG: query: SELECT SUM(field) FROM table > DEBUG: ProcessQuery > DEBUG: CommitTransactionCommand > > Log seems ok to me but still SUM() doesn't work on VB side. > Hmm, could you get the client-side log, psqlodbc.log, mylog etc ? regards, Hiroshi Inoue