Thread: How to release savepoints properly
Hello!
(Preamble: AUTOCOMMIT is off)
When I call SQLExecDirect(SELECT * FROM B...) in the pg_stat_activity I see "idle in transaction" for query "RELEASE _EXEC_SVP_0x10a0df600;SAVEPOINT _EXEC_SVP_0x10a0df600;SELECT * FROM B" even after SQLFreeStmt(SQL_CLOSE + SQL_UNBIND + SQL_RESET_PARAMS).
I guess that first "RELEASE" in the generated query is needed to release currently active savepoint which was executed under the hood (generated in GenerateSvpCommand()) within previous SQLExecDirect(SELECT * FROM A) - in other words we are renewing the savepoint every SQLExecDirect.
In my point of view RELEASE should also be called under the hood(in PGAPI_FreeStmt()) on SQLStmtFree(SQL_CLOSE). Otherwise the last query locks table B forever and I cannot modify table B from other connections.
At the same time I completely understand there is already 12th release and admit that I rather do not understand something and everything is by design.
Should I call just SQLEndTran(despite the fact that just SELECT was executed and nothing really can be rolled back) in such case?
macos 10.15.7
psql-odbc 12.02.0000
unixodbc 2.3.9
Thank you!