SC_set_error(stmt, STMT_SEQUENCE_ERROR, "Statement is currently executing a transaction.", func);
                return SQL_ERROR; /* stmt may be executing a transaction */
            }
+           /*
+            *  Before dropping the statement, sync and discard
+            *  the response from the server for the pending
+            *  extended query.
+            */
+           if (NULL != conn->sock && stmt == conn->stmt_in_extquery)
+               QR_Destructor(SendSyncAndReceive(stmt, NULL, "finish the pending query"));
+           conn->stmt_in_extquery = NULL; /* for safety */
            /*
             * Free any cursors and discard any result info.
             * Don't detach the statement from the connection
 
 #define POSTGRESDRIVERVERSION      "09.00.0311"
 #define POSTGRES_RESOURCE_VERSION  "09.00.0311\0"
 #define PG_DRVFILE_VERSION     9,0,03,11
-#define PG_BUILD_VERSION       "201111110001"
+#define PG_BUILD_VERSION       "201111120001"
 
 #endif