Weird problem with aggregate functions

From: "Andrea Aime" <aaime(at)comune(dot)modena(dot)it>
To: Postgres ODBC <pgsql-odbc(at)postgresql(dot)org>
Subject: Weird problem with aggregate functions
Date: 2001-11-06 10:20:56
Message-ID: 3BE7B988.B0BC180D@comune.modena.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

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
conn.Open "DSN=DatabaseSIA"

Set rec = New Recordset

rec.Open "Select SUM(popolazione) from tab2531", conn, adOpenStatic,
adLockReadOnly
Me.Print rec.Fields(0).Name & ": " & rec.Fields(0).Value
rec.Close
End Sub

where tab2531 is defined as follows:

CREATE TABLE "tab2531" (
"abbreviazione" text,
"regione" int4,
"popolazione" int4,
"densita" int4,
"natalita" float8,
"mortalita" float8,
"mortalinfant" float8,
"nuzialita" float8
);

The program halts with this error (translated from italian): "data
provider
or another service returned E_FAIL"
I tested this with 7.01.0008 and 7.01.0007 both on WinNT and Win2000...
same results. I also played with driver options. commlog doesn't report
any error. Ah, I use ADO 2.6 (tested also with 2.5, same results)
Any idea?
Best regards
Andrea Aime

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Andrea Aime 2001-11-06 10:48:40 Re: Weird problem with aggregate functions
Previous Message Stuart 2001-10-31 23:07:11 Performance problems