diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index 401299e5420..10ecc2976e8 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -6254,8 +6254,11 @@ plan_create_index_workers(Oid tableOid, Oid indexOid) double reltuples; double allvisfrac; - /* Return immediately when parallelism disabled */ - if (max_parallel_maintenance_workers == 0) + /* + * We don't allow performing parallel operation in standalone backend or + * when parallelism is disabled. + */ + if (!IsUnderPostmaster || max_parallel_maintenance_workers == 0) return 0; /* Set up largely-dummy planner state */