diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c
index b04b6a0e54..4406a9c3b3 100644
--- a/contrib/postgres_fdw/postgres_fdw.c
+++ b/contrib/postgres_fdw/postgres_fdw.c
@@ -1632,9 +1632,6 @@ remove_async_node(ForeignScanState *node)
 
 	if (leader == node)
 	{
-		/* It's the leader */
-		ForeignScanState	*next_leader;
-
 		if (leader_state->s.commonstate->busy)
 		{
 			/*
@@ -1769,7 +1766,7 @@ postgresIterateForeignScan(ForeignScanState *node)
 			node->ss.ps.asyncstate = AS_AVAILABLE;
 		else
 			node->ss.ps.asyncstate = AS_WAITING;
-
+elog(WARNING, "No tuple result %d", fsstate->cursor_number);
 		return ExecClearTuple(slot);
 	}
 
@@ -3703,7 +3700,7 @@ request_more_data(ForeignScanState *node)
 
 	snprintf(sql, sizeof(sql), "FETCH %d FROM c%u",
 			 fsstate->fetch_size, fsstate->cursor_number);
-
+elog(WARNING, "FETCH: %s", sql);
 	if (!PQsendQuery(conn, sql))
 		pgfdw_report_error(ERROR, NULL, conn, false, sql);
 
@@ -3769,7 +3766,6 @@ fetch_received_data(ForeignScanState *node)
 	PG_TRY();
 	{
 		PGconn	   *conn = fsstate->s.conn;
-		char		sql[64];
 		int			addrows;
 		size_t		newsize;
 		int			i;
@@ -3798,7 +3794,7 @@ fetch_received_data(ForeignScanState *node)
 										   node,
 										   fsstate->temp_cxt);
 		}
-
+elog(WARNING, "fetch cursor: %d (%d %d)", fsstate->cursor_number, fsstate->num_tuples, addrows);
 		/* Update fetch_ct_2 */
 		if (fsstate->fetch_ct_2 < 2 && fsstate->next_tuple == 0)
 			fsstate->fetch_ct_2++;
