Author: turnstep
Date: Mon Apr 5 12:08:17 2010
New Revision: 13883
Modified:
DBD-Pg/trunk/Changes
DBD-Pg/trunk/Pg.pm
DBD-Pg/trunk/dbdimp.c
Log:
Do not automatically ROLLBACK on a failed pg_cancel(). CPAN bug #55188
Modified: DBD-Pg/trunk/Changes
==============================================================================
--- DBD-Pg/trunk/Changes (original)
+++ DBD-Pg/trunk/Changes Mon Apr 5 12:08:17 2010
@@ -2,6 +2,7 @@
2.17.0
+ - Do not automatically ROLLBACK on a failed pg_cancel (CPAN bug #55188)
- Added support for new lo_import_with_oid function.
[GSM] (CPAN bug #53835)
- Don't limit stored user name to \w in tests (CPAN bug #54372)
Modified: DBD-Pg/trunk/Pg.pm
==============================================================================
--- DBD-Pg/trunk/Pg.pm (original)
+++ DBD-Pg/trunk/Pg.pm Mon Apr 5 12:08:17 2010
@@ -3909,8 +3909,9 @@
This database-level method attempts to cancel any currently running
asynchronous query. It returns true if
the cancel succeeded, and false otherwise. Note that a query that has finished
before this method is executed
-will also return false. B<WARNING>: a successful cancellation will leave the
database in an unusable state,
-so DBD::Pg will automatically clear out the error message and issue a ROLLBACK.
+will also return false. B<WARNING>: a successful cancellation may leave the
database in an unusable state,
+so you may need to ROLLBACK or ROLLBACK TO a savepoint. As of version 2.17.0
of DBD::Pg, rollbacks are
+not done automatically.
$result = $dbh->pg_cancel();
Modified: DBD-Pg/trunk/dbdimp.c
==============================================================================
--- DBD-Pg/trunk/dbdimp.c (original)
+++ DBD-Pg/trunk/dbdimp.c Mon Apr 5 12:08:17 2010
@@ -4706,10 +4706,8 @@
/*
Attempt to cancel a running asynchronous query
Returns true if the cancel succeeded, and false if it did not
-If it did successfully cancel the query, it will also do a rollback.
-Note that queries which have finished do not cause a rollback.
In this case, pg_cancel will return false.
-NOTE: We only return true if we cancelled and rolled back!
+NOTE: We only return true if we cancelled
*/
/* ================================================================== */
@@ -4769,11 +4767,9 @@
status = _sqlstate(aTHX_ imp_dbh, result);
- /* If we actually cancelled a running query, perform a rollback */
+ /* If we actually cancelled a running query, just return true - the
caller must rollback if needed */
if (0 == strncmp(imp_dbh->sqlstate, "57014", 5)) {
- if (TRACE3) { TRC(DBILOGFP, "%sRolling back after cancelled
query\n", THEADER); }
- dbd_db_rollback(h, imp_dbh);
- if (TEND) TRC(DBILOGFP, "%sEnd pg_db_cancel (rollback)\n",
THEADER);
+ if (TEND) TRC(DBILOGFP, "%sEnd pg_db_cancel\n", THEADER);
return DBDPG_TRUE;
}