Re: Weird problem with aggregate functions

From: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>
To: andrea(dot)aime(at)comune(dot)modena(dot)it
Cc: Postgres ODBC <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: Weird problem with aggregate functions
Date: 2001-11-06 10:55:55
Message-ID: 3BE7C1BB.BAB98D0C@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Andrea Aime wrote:
>
> Hi everybody,
> I got a problem with aggregate functions from VB 6. SUM, AVG, STDDEV,
> and VARIANCE doesn't work on int4 types (but they're working on float8),
> whereas MAX and MIN work also on int4... that's weird!
> Even more strange, the above functions work both from psql and from
> pgAdmin II... but not in the following code:
>
> Private Sub Form_Load()
> Dim conn As ADODB.Connection
> Dim rec As ADODB.Recordset
> Dim cmd As Command
>
> Set conn = New Connection
> conn.CursorLocation = adUseClient

This indicates ADO to use Microsoft Cursor Service for OLE DB.
Microsoft Cursor Service seems to expect the server to
return e.g. int4 type for sum(int4) but PostgreSQL returns
numeric type as sum(int4).
Probably you would get the expected result if you
use sum(..)::int4.

regards,
Hiroshi Inoue

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Andy Hallam 2001-11-06 15:38:22 ODBC and Native error codes
Previous Message Andrea Aime 2001-11-06 10:48:40 Re: Weird problem with aggregate functions