diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c
index 1482436..9fe16cf 100644
--- a/contrib/postgres_fdw/postgres_fdw.c
+++ b/contrib/postgres_fdw/postgres_fdw.c
@@ -1667,6 +1667,11 @@ remove_async_node(ForeignScanState *node)
 
 		if (cur == node)
 		{
+			PGconn *conn = curstate->s.conn;
+
+			while(PQisBusy(conn))
+				PQclear(PQgetResult(conn));
+
 			prev_state->waiter = curstate->waiter;
 
 			/* relink to the previous node if the last node was removed */
