Skip site navigation (1) Skip section navigation (2)

psqlodbc-09.00.0310 Crash issues with aggregate function based queries.. specifically SUM and AVG.

From: Arvind N <Arvind(dot)N(at)citrix(dot)com>
To: "pgsql-odbc(at)postgresql(dot)org" <pgsql-odbc(at)postgresql(dot)org>
Subject: psqlodbc-09.00.0310 Crash issues with aggregate function based queries.. specifically SUM and AVG.
Date: 2011-09-22 07:10:58
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-odbc
     While using inline with poco libraries SQL query support, noticed consistent crashes in  the odbc library. The issue seems to be only with SUM and AVG aggregate handling . 

The query in question is the below one. Consistently I keep getting odbc crashes. Verified this same query works fine using java postgres drivers. Also verified that postgres databases is not having any problems and returns properly. The issue is only when Poco library parses the response and it calls the SQLDescribeCol (statement_handle=0xc44000, column_number=8 ..... ) to extract output from response.  NOTE: max() function does not seem to have any issue. 

Find below the gdb trace back. The issue narrows down getAtttypmodEtc (stmt=0x0, col=4, adtsize_or_longestlen=0x7fffff5fa7c8) at pgtypes.c:1448 always in all the crashes. Tracing back pgtypes.c I see that some fix was done to QR_get_value_backend_text macro call, the  9.00.0200 version of ODBC seems to have (res,col,i) and in 9.00.0310 seems to have changed to for some fix I guess... but there still is some issue here. NOTE: the same below query sometimes works and the same sometimes causes crashes. Crashes being more often.  The column number shows passed to SQLDescribeCol (StatementHandle=0xc4f400, ColumnNumber=8) says 8 and this corresponds to SUM(stnsoctet_delta_count). Any pointers would be most helpful. Is this a known issue... ???????

********************************** pgtypes.c ***********************************

1443        		          for (i = 0; i < res->num_cached_rows; i++)
1444                                                 {
1445                                                         if (tval = QR_get_value_backend_text(res, i, col), NULL != tval)
1446                                                         {
1447                                                                 if (sptr = strchr(tval, '.'), NULL != sptr)
1448                                                                         if (sval = strlen(tval) - (sptr + 1 - tval), sval > max     scale)
1449                                                                                 maxscale = sval;
1450                                                         }
1451                                                 }

select distinct ctnssource_ip_address, ctnsappname, http_req_url, count(http_req_url) as count_url, http_req_host, exporter_id, SUM(egresssvcoutoctet_delta_count),SUM(stnsoctet_delta_count), MAX(latestdatarecord_rx_time) from af_master_table GROUP BY ctnssource_ip_address, http_req_url, ctnsappname, http_req_host, exporter_id ORDER BY count_url DESC

GDB trace :::

#152 0x00000008042b7df5 in __FUNCTION__.6 () from /var/mps/install/lib/
#153 0x00000008042828ad in getAtttypmodEtc (stmt=0x0, col=4, adtsize_or_longestlen=0x7fffff5fa7c8) at pgtypes.c:1448
#154 0x0000000804282a78 in pgtype_column_size (stmt=0xc4f400, type=1700, col=4, handle_unknown_size_as=0) at pgtypes.c:1794
#155 0x0000000804286ad6 in PGAPI_DescribeCol (hstmt=0xc4f400, icol=7, szColName=0xc5c040 "", cbColNameMax=2048, 
    pcbColName=0xc5c840, pfSqlType=0xc5c842, pcbColDef=0xc5c848, pibScale=0xc5c850, pfNullable=0xc5c852) at results.c:360
#156 0x000000080429fe49 in SQLDescribeCol (StatementHandle=0xc4f400, ColumnNumber=8, ColumnName=0xc5c040 "", BufferLength=2048, 
    NameLength=0xc5c840, DataType=0xc5c842, ColumnSize=0x17e, DecimalDigits=0x17e, Nullable=0x17e) at odbcapi.c:283
#157 0x00000008025cd8e0 in SQLDescribeCol (statement_handle=0xc44000, column_number=8, column_name=0xc5c040 "", 
    buffer_length=2048, name_length=0xc5c840, data_type=0xc5c842, column_size=0xc5c848, decimal_digits=0xc5c850, nullable=0xc5c852)
    at SQLDescribeCol.c:447
#158 0x000000080222c5fa in Poco::Data::ODBC::ODBCColumn::getDescription () from lib//
#159 0x000000080222c685 in Poco::Data::ODBC::ODBCColumn::init () from lib//
#160 0x000000080222ca0c in Poco::Data::ODBC::ODBCColumn::ODBCColumn () from lib//
#161 0x00000008022321da in Poco::Data::ODBC::ODBCStatementImpl::fillColumns () from lib//
#162 0x0000000802232cba in Poco::Data::ODBC::ODBCStatementImpl::compileImpl () from lib//
#163 0x00000008020f3e08 in Poco::Data::StatementImpl::compile () from lib//
#164 0x00000008020f3f1f in Poco::Data::StatementImpl::executeWithLimit () from lib//
#165 0x00000008020f40d3 in Poco::Data::StatementImpl::execute () from lib//



pgsql-odbc by date

Next:From: rhDate: 2011-09-24 10:29:51
Subject: ODBC with Client cers
Previous:From: Tom LaneDate: 2011-09-12 23:08:03
Subject: Re: MSAccess to postgres on Windows Currency type problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group