diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
new file mode 100644
index 33720e8..9521c48
*** a/src/backend/tcop/postgres.c
--- b/src/backend/tcop/postgres.c
*************** exec_simple_query(const char *query_stri
*** 1163,1168 ****
--- 1163,1174 ----
  		NullCommand(dest);
  
  	/*
+ 	 * We have already committed, so clear any cancel requests
+ 	 * that might be processed by the ereport() calls below.
+ 	 */
+ 	QueryCancelPending = false;
+ 
+ 	/*
  	 * Emit duration logging if appropriate.
  	 */
  	switch (check_log_duration(msec_str, was_logged))
