pgsql: Improve error message for MaxAllocSize overrun in accumArrayResu

2023-07-14 Thread Tom Lane
Improve error message for MaxAllocSize overrun in accumArrayResult. Before, if you went past about 64M array elements in array_agg() and allied functions, you got a generic "invalid memory alloc request size" error. This patch replaces that with "array size exceeds the maximum allowed", which see

pgsql: Allow plan nodes with initPlans to be considered parallel-safe.

2023-07-14 Thread Tom Lane
Allow plan nodes with initPlans to be considered parallel-safe. If the plan itself is parallel-safe, and the initPlans are too, there's no reason anymore to prevent the plan from being marked parallel-safe. That restriction (dating to commit ab77a5a45) was really a special case of the fact that w

pgsql: Account for optimized MinMax aggregates during SS_finalize_plan.

2023-07-14 Thread Tom Lane
Account for optimized MinMax aggregates during SS_finalize_plan. We are capable of optimizing MIN() and MAX() aggregates on indexed columns into subqueries that exploit the index, rather than the normal thing of scanning the whole table. When we do this, we replace the Aggref node(s) with Params

pgsql: Simplify option handling in pg_ctl.

2023-07-14 Thread Nathan Bossart
Simplify option handling in pg_ctl. Now that the in-tree getopt_long() moves non-options to the end of argv (see commit 411b720343), we can remove pg_ctl's workaround for getopt_long() implementations that don't reorder argv. Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/2023071303