mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
Allow parallel query for prepared statements with generic plans.
This was always intended to work, but due to an oversight in max_parallel_hazard_walker, it didn't. In testing, we missed the fact that it was only working for custom plans, where the parameter value has been substituted for the parameter itself early enough that everything worked. In a generic plan, the Param node survives and must be treated as parallel-safe. SerializeParamList provides for the transmission of parameter values to workers. Amit Kapila with help from Kuntal Ghosh. Some changes by me. Discussion: http://postgr.es/m/CAA4eK1+_BuZrmVCeua5Eqnm4Co9DAXdM5HPAOE2J19ePbR912Q@mail.gmail.com
This commit is contained in:
@ -1223,13 +1223,17 @@ max_parallel_hazard_walker(Node *node, max_parallel_hazard_context *context)
|
||||
|
||||
/*
|
||||
* We can't pass Params to workers at the moment either, so they are also
|
||||
* parallel-restricted, unless they are PARAM_EXEC Params listed in
|
||||
* safe_param_ids, meaning they could be generated within the worker.
|
||||
* parallel-restricted, unless they are PARAM_EXTERN Params or are
|
||||
* PARAM_EXEC Params listed in safe_param_ids, meaning they could be
|
||||
* generated within the worker.
|
||||
*/
|
||||
else if (IsA(node, Param))
|
||||
{
|
||||
Param *param = (Param *) node;
|
||||
|
||||
if (param->paramkind == PARAM_EXTERN)
|
||||
return false;
|
||||
|
||||
if (param->paramkind != PARAM_EXEC ||
|
||||
!list_member_int(context->safe_param_ids, param->paramid))
|
||||
{
|
||||
|
Reference in New Issue
Block a user