Skip to content

Commit

Permalink
Fix "ON CONFLICT ON CONSTRAINT" on plain PostgreSQL tables
Browse files Browse the repository at this point in the history
In the planner hook, we erroneously blocked "ON CONFLICT ON
CONSTRAINT" statements on plain tables. This fixes the issue
so that this error only occurs on hypertables.
  • Loading branch information
erimatnor committed Oct 5, 2017
1 parent 4c451e0 commit ce12104
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/planner.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,13 +368,6 @@ modifytable_plan_walker(Plan **planptr, void *pctx)
ListCell *lc_plan,
*lc_rel;

if (ctx->parse->onConflict != NULL &&
ctx->parse->onConflict->constraint != InvalidOid)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("Hypertables do not support ON CONFLICT statements that reference constraints"),
errhint("Use column names to infer indexes instead.")));

/*
* To match up tuple-producing subplans with result relations, we
* simultaneously loop over subplans and resultRelations, although
Expand All @@ -391,6 +384,13 @@ modifytable_plan_walker(Plan **planptr, void *pctx)
void **subplan_ptr = &lfirst(lc_plan);
Plan *subplan = *subplan_ptr;

if (ctx->parse->onConflict != NULL &&
ctx->parse->onConflict->constraint != InvalidOid)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("Hypertables do not support ON CONFLICT statements that reference constraints"),
errhint("Use column names to infer indexes instead.")));

/*
* We replace the plan with our custom chunk dispatch
* plan.
Expand Down

0 comments on commit ce12104

Please sign in to comment.