ADO CommandTimeout vs Postgres statement_timeout parameter

From: Richard Hetherington <hetheringtonrichard(at)hotmail(dot)com>
To: "pgsql-odbc(at)postgresql(dot)org" <pgsql-odbc(at)postgresql(dot)org>
Cc: "james(dot)willison(at)aztecretail(dot)co(dot)uk" <james(dot)willison(at)aztecretail(dot)co(dot)uk>, Brad Bence <brad(dot)bence(at)aztecretail(dot)co(dot)uk>
Subject: ADO CommandTimeout vs Postgres statement_timeout parameter
Date: 2016-05-18 12:12:06
Message-ID: DUB125-W35BA25E36CB3CA602B37B3BB490@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Hi, I have been debugging why the ADO CommandTimeout property has no effect on Postgres Queries and I believe that it is being ignored. Is this something that could be modified in a future ODBC Driver release. What I would like to see is an auto prepending of this value to a SQL Query being passed in if set.

I understand that the statement_timeout config parameter in postgres can be configured at the server level, user level and query level. I have tested each and they work as expected. What I wasn't expecting was for my CommandTimeout to be ignored / not passed through.

e.g.

Set p_objConn = Server.CreateObject("ADODB.Connection")
p_objConn.ConnectionString = "SOME DSN or DSNLess Connection String"
' e.g. DB.ConnectionString = "Driver={PostgreSQL UNICODE};Server=localhost;Port=5432;UID=someuser;PWD=somepassword;Database=somedatabase;"
p_objConn.ConnectionTimeout = 10
p_objConn.Open
p_objConn.CommandTimeout = 30 ' This has no effect on queries run against Postgres !!

If The ADO CommandTimeout value is set, could this be detected, check that the SQL Query hasn't already got a statement_timeout value and if not prepend the SQL Query as follows:

SET statement_timeout = 30000;

SELECT somedata FROM
somedatabasetable WHERE somevalue=anothervalue,

Many thanks in advance.

Feel free to contact me if you need any further information.

RICHARD HETHERINGTON

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Inoue, Hiroshi 2016-05-18 12:20:33 Re: PostgreSQL: SQLSetPos fails with SetPos update return error.
Previous Message Venkatesan, Sekhar 2016-05-17 17:53:58 Re: PostgreSQL: SQLSetPos fails with SetPos update return error.