Weird problem with aggregate functions
От | Andrea Aime |
---|---|
Тема | Weird problem with aggregate functions |
Дата | |
Msg-id | 3BE7B988.B0BC180D@comune.modena.it обсуждение исходный текст |
Список | 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
В списке pgsql-odbc по дате отправления: