Skip to content

Instantly share code, notes, and snippets.

@sdressler
Created June 18, 2019 18:57
Show Gist options
  • Save sdressler/9fa5b4e3b42c62e98126a3e6cdf90179 to your computer and use it in GitHub Desktop.
Save sdressler/9fa5b4e3b42c62e98126a3e6cdf90179 to your computer and use it in GitHub Desktop.
Make postgres_fdw parallel scan safe patch
--- a/contrib/postgres_fdw/postgres_fdw.c
+++ b/contrib/postgres_fdw/postgres_fdw.c
@@ -451,6 +451,7 @@ static void merge_fdw_options(PgFdwRelationInfo *fpinfo,
const PgFdwRelationInfo *fpinfo_o,
const PgFdwRelationInfo *fpinfo_i);
+static bool postgresIsForeignScanParallelSafe(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte);
/*
* Foreign-data wrapper handler function: return a struct with pointers
@@ -505,6 +506,8 @@ postgres_fdw_handler(PG_FUNCTION_ARGS)
/* Support functions for upper relation push-down */
routine->GetForeignUpperPaths = postgresGetForeignUpperPaths;
+ routine->IsForeignScanParallelSafe = postgresIsForeignScanParallelSafe;
+
PG_RETURN_POINTER(routine);
}
@@ -5822,3 +5825,6 @@ find_em_expr_for_rel(EquivalenceClass *ec, RelOptInfo *rel)
/* We didn't find any suitable equivalence class expression */
return NULL;
}
+static bool postgresIsForeignScanParallelSafe(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte) {
+ return true;
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment