How to release savepoints properly

From: Daniil Megrabyan <danil(dot)megrabjan(at)gmail(dot)com>
To: pgsql-odbc(at)postgresql(dot)org
Subject: How to release savepoints properly
Date: 2020-10-02 11:57:11
Message-ID: 6107859B-FCEC-4BDE-97DC-27C8F1559B5E@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

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!

Browse pgsql-odbc by date

  From Date Subject
Next Message Daniil Megrabyan 2020-10-02 12:29:40 How to release savepoints properly?
Previous Message Андрей Шиканов 2020-09-30 11:07:31