@@ -237,6 +237,16 @@ start_bgworker(const char bgworker_name[BGW_MAXLEN],
237237return true;
238238}
239239
240+ /*
241+ * Show generic error message if we failed to start bgworker.
242+ */
243+ static inline void
244+ start_bgworker_errmsg (const char * bgworker_name )
245+ {
246+ ereport (ERROR , (errmsg ("could not start %s" ,bgworker_name ),
247+ errhint ("consider increasing max_worker_processes" )));
248+ }
249+
240250
241251/*
242252 * --------------------------------------
@@ -314,10 +324,13 @@ create_partitions_for_value_bg_worker(Oid relid, Datum value, Oid value_type)
314324#endif
315325
316326/* Start worker and wait for it to finish */
317- (void )start_bgworker (spawn_partitions_bgw ,
318- CppAsString (bgw_main_spawn_partitions ),
319- UInt32GetDatum (segment_handle ),
320- true);
327+ if (!start_bgworker (spawn_partitions_bgw ,
328+ CppAsString (bgw_main_spawn_partitions ),
329+ UInt32GetDatum (segment_handle ),
330+ true))
331+ {
332+ start_bgworker_errmsg (spawn_partitions_bgw );
333+ }
321334
322335/* Save the result (partition Oid) */
323336child_oid = bgw_args -> result ;
@@ -742,6 +755,8 @@ partition_table_concurrently(PG_FUNCTION_ARGS)
742755{
743756/* Couldn't start, free CPS slot */
744757cps_set_status (& concurrent_part_slots [empty_slot_idx ],CPS_FREE );
758+
759+ start_bgworker_errmsg (concurrent_part_bgw );
745760}
746761
747762/* Tell user everything's fine */