pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniil Megrabyan <danil.megrabjan@gmail.com>
To: pgsql-odbc@lists.postgresql.org
Subject: How to release savepoints properly?
Date: Fri, 2 Oct 2020 15:29:40 +0300
Message-ID: <FCE8CCAA-E141-48B2-A4CE-30D3EEC5D54B@gmail.com> (raw)

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!=

view thread (3+ messages)

Message-ID: <FCE8CCAA-E141-48B2-A4CE-30D3EEC5D54B@gmail.com>
Permalink:  ../FCE8CCAA-E141-48B2-A4CE-30D3EEC5D54B@gmail.com/
Also on:    postgresql.org/message-id/FCE8CCAA-E141-48B2-A4CE-30D3EEC5D54B@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: danil.megrabjan@gmail.com
  Subject: Re: How to release savepoints properly?
  In-Reply-To: <FCE8CCAA-E141-48B2-A4CE-30D3EEC5D54B@gmail.com>
  References: <FCE8CCAA-E141-48B2-A4CE-30D3EEC5D54B@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox