diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c
index 080cb0a..e3847ce 100644
--- a/contrib/postgres_fdw/postgres_fdw.c
+++ b/contrib/postgres_fdw/postgres_fdw.c
@@ -2949,7 +2949,8 @@ create_cursor(ForeignScanState *node)
 	initStringInfo(&buf);
 	appendStringInfo(&buf, "DECLARE c%u CURSOR FOR\n%s",
 					 fsstate->cursor_number, fsstate->query);
-
+	if (node->limit > 0)
+		appendStringInfo(&buf, " LIMIT %lld", (long long)node->limit);
 	/*
 	 * Notice that we pass NULL for paramTypes, thus forcing the remote server
 	 * to infer types for all parameters.  Since we explicitly cast every
diff --git a/src/backend/executor/nodeLimit.c b/src/backend/executor/nodeLimit.c
index aaec132..675beb5 100644
--- a/src/backend/executor/nodeLimit.c
+++ b/src/backend/executor/nodeLimit.c
@@ -316,10 +316,10 @@ recompute_limits(LimitState *node)
 static void
 pass_down_bound(LimitState *node, PlanState *child_node)
 {
+	int64		tuples_needed = node->count + node->offset;
 	if (IsA(child_node, SortState))
 	{
 		SortState  *sortState = (SortState *) child_node;
-		int64		tuples_needed = node->count + node->offset;

 		/* negative test checks for overflow in sum */
 		if (node->noCount || tuples_needed < 0)
@@ -341,6 +341,11 @@ pass_down_bound(LimitState *node, PlanState *child_node)
 		for (i = 0; i < maState->ms_nplans; i++)
 			pass_down_bound(node, maState->mergeplans[i]);
 	}
+	else if (IsA(child_node, ForeignScanState))
+	{
+		ForeignScanState  *fsState = (ForeignScanState *) child_node;
+		fsState->limit = tuples_needed;
+	}
 	else if (IsA(child_node, ResultState))
 	{
 		/*
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index d33392f..d706d87 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -1502,6 +1502,7 @@ typedef struct ForeignScanState
 	ScanState	ss;				/* its first field is NodeTag */
 	ExprState  *fdw_recheck_quals;		/* original quals not in ss.ps.qual */
 	Size		pscan_len;		/* size of parallel coordination information */
+	int64		limit;			/* pushed down limit */
 	/* use struct pointer to avoid including fdwapi.h here */
 	struct FdwRoutine *fdwroutine;
 	void	   *fdw_state;		/* foreign-data wrapper can keep state here */
