diff options
| author | Tomas Vondra | 2017-01-09 21:10:56 +0000 |
|---|---|---|
| committer | Tomas Vondra | 2017-01-09 21:10:56 +0000 |
| commit | 695d5ba977f5f78faa2e0cafd04401a5978196e5 (patch) | |
| tree | b10b062d1b50519cfb0c00b22814bd0bb225948e | |
| parent | 512af227199a480f74b2906ab534a07453e80c28 (diff) | |
fix segfault in subquery_planner() when accessing parent_root
The check was moved at the very beginning, not realizing the pointer
may be NULL for outer-most queries. So evaluate the level explicitly.
| -rw-r--r-- | src/backend/optimizer/plan/planner.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index 8d1cf8104f..4a11d5a29b 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -505,7 +505,8 @@ subquery_planner(PlannerGlobal *glob, Query *parse, #ifdef XCP /* XL currently does not support DML in subqueries. */ - if ((parse->commandType != CMD_SELECT) && (parent_root->query_level > 0)) + if ((parse->commandType != CMD_SELECT) && + ((parent_root ? parent_root->query_level + 1 : 1) > 1)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("INSERT/UPDATE/DELETE is not supported in subquery"))); |
