Re: Weird problem with aggregate functions - Mailing list pgsql-odbc

From Hiroshi Inoue
Subject Re: Weird problem with aggregate functions
Date
Msg-id 3BE7C1BB.BAB98D0C@tpf.co.jp
Whole thread Raw
In response to Weird problem with aggregate functions  ("Andrea Aime" <aaime@comune.modena.it>)
List 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

pgsql-odbc by date:

Previous
From: "Andrea Aime"
Date:
Subject: Weird problem with aggregate functions
Next
From: "Andrea Aime"
Date:
Subject: Re: Weird problem with aggregate functions