psql-savepoint-cac.txt

text/plain

Filename: psql-savepoint-cac.txt
Type: text/plain
Part: 0
Message: Re: BUG #16867: savepoints vs. commit and chain
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c
index 6f507104f4..0ef9367ff3 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -1350,12 +1350,13 @@ SendQuery(const char *query)
 
 				/*
 				 * Do nothing if they are messing with savepoints themselves:
-				 * If the user did RELEASE or ROLLBACK, our savepoint is gone.
-				 * If they issued a SAVEPOINT, releasing ours would remove
-				 * theirs.
+				 * If the user did COMMIT AND CHAIN, RELEASE or ROLLBACK,
+				 * our savepoint is gone. If they issued a SAVEPOINT,
+				 * releasing ours would remove theirs.
 				 */
 				if (results &&
-					(strcmp(PQcmdStatus(results), "SAVEPOINT") == 0 ||
+					(strcmp(PQcmdStatus(results), "COMMIT") == 0 ||
+					 strcmp(PQcmdStatus(results), "SAVEPOINT") == 0 ||
 					 strcmp(PQcmdStatus(results), "RELEASE") == 0 ||
 					 strcmp(PQcmdStatus(results), "ROLLBACK") == 0))
 					svptcmd = NULL;