Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kOJge-0003zg-14 for pgsql-odbc@arkaria.postgresql.org; Fri, 02 Oct 2020 11:57:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kOJgb-00082N-Pf for pgsql-odbc@arkaria.postgresql.org; Fri, 02 Oct 2020 11:57:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kOJgb-00082G-KF for pgsql-odbc@lists.postgresql.org; Fri, 02 Oct 2020 11:57:17 +0000 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kOJgZ-00086h-Dy for pgsql-odbc@postgresql.org; Fri, 02 Oct 2020 11:57:16 +0000 Received: by mail-lf1-x142.google.com with SMTP id w11so1527244lfn.2 for ; Fri, 02 Oct 2020 04:57:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:mime-version:subject:message-id:date:to; bh=TUhdufVUzqraUVxJCgfkgj9jO3bMn1ALaaK2+3LC8qU=; b=KJjPd8brEBw1p4XKs0SUH4ENnjXdDUEpZE9rzd2KmtKymxoJHPm72/43nCXKJ7yXlv FtS6zkTVZis3zdj+qJOuX6i0Nmp0/E7G9G/ZWRIxtmxTnty3r7OmMpvLCtdTCMBA1uzH w1eDM8a3qjgB/Q23ne2TGI+XTWG9adX6smvNJ/pgVBH6By6U4rUTJc190tEfcChXWa4d TaFIRw/3S8JQvxM8kGIh14wZMnoQZeP9T1QSv3XfgCLxOHD80MqIyTrzFAvwTtady2Yw 1rGg2dGVzhkgzxhjyFjz4mSpDNglbIdk6/6ZTRFJAR/LC15POTFQF88OBFP8IK4BtFAs q6SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:message-id:date:to; bh=TUhdufVUzqraUVxJCgfkgj9jO3bMn1ALaaK2+3LC8qU=; b=lNrYXei66l9Xac4smuuPnHgf42xi0559MXtdDNvbpjmOF3aup9EsCUnJ91C4Ujkwzi /s+txDIQ7ETFj566gI3hMfF/ywxZfaJEriB5jUyXv1j2JJdQ29+9aQu1zApDI2NjhRXA ClH8PYp3DWfqAn51CI2TWh0KyeYGI2/OLr1CTzj01OqBfOm/vAa9ZETUgqZM/woXimvU CC2Q0g936/Da/pQoOdso0blobRnsClTQ7aeYPAZOZm7BnHLlr9+osqF2BOnFjtPijFVe UL7xLtoU1Wa/G1g0ArMUkBQUnN/mNZA/3Yehwqn0ERKXXTfEE3iktGKd2c/gYqrG5o6O sZfQ== X-Gm-Message-State: AOAM530b0DMDGsgz+HNVffBbMwOxrtPM+eEyqmudMQ0utGQAsslf/1fN uHPAnKnntBa8ZiNchV1eE0+LBfFkuDw= X-Google-Smtp-Source: ABdhPJxiw/aMvzPAKdbFxwl3LmpBQTwiO+nArx5ZKshwbN1hBesGDJeryqMntrnWHKIj73wxUF+Qkg== X-Received: by 2002:a19:8983:: with SMTP id l125mr663540lfd.499.1601639832740; Fri, 02 Oct 2020 04:57:12 -0700 (PDT) Received: from minibagroff.cadabra ([31.134.191.117]) by smtp.gmail.com with ESMTPSA id p7sm256114lfh.49.2020.10.02.04.57.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Oct 2020 04:57:12 -0700 (PDT) From: Daniil Megrabyan Content-Type: multipart/alternative; boundary="Apple-Mail=_3BE40D47-040E-433A-9CBC-60B0B553C3FC" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: How to release savepoints properly Message-Id: <6107859B-FCEC-4BDE-97DC-27C8F1559B5E@gmail.com> Date: Fri, 2 Oct 2020 14:57:11 +0300 To: pgsql-odbc@postgresql.org X-Mailer: Apple Mail (2.3608.120.23.2.4) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_3BE40D47-040E-433A-9CBC-60B0B553C3FC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 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).=20 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.=20 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.=20 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?=20 macos 10.15.7 psql-odbc 12.02.0000 unixodbc 2.3.9 Thank you!= --Apple-Mail=_3BE40D47-040E-433A-9CBC-60B0B553C3FC Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
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!
= --Apple-Mail=_3BE40D47-040E-433A-9CBC-60B0B553C3FC--