Skip to content

Commit 967d13f

Browse files
committed
show error message if ON CONFLICT clause is present, improve comments
1 parent 21ea8b5 commit 967d13f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/partition_filter.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,20 +374,28 @@ make_partition_filter(Plan *subplan, Oid parent_relid,
374374
CustomScan *cscan = makeNode(CustomScan);
375375
Relation parent_rel;
376376

377+
/* Currenly we don't support ON CONFLICT clauses */
378+
if (conflict_action != ONCONFLICT_NONE)
379+
ereport(ERROR,
380+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
381+
errmsg("ON CONFLICT clause is not supported with partitioned tables")));
382+
383+
/* Copy costs etc */
377384
cscan->scan.plan.startup_cost = subplan->startup_cost;
378385
cscan->scan.plan.total_cost = subplan->total_cost;
379386
cscan->scan.plan.plan_rows = subplan->plan_rows;
380387
cscan->scan.plan.plan_width = subplan->plan_width;
381388

389+
/* Setup methods and child plan */
382390
cscan->methods = &partition_filter_plan_methods;
383391
cscan->custom_plans = list_make1(subplan);
384392

393+
/* Build an appropriate target list using a cached Relation entry */
385394
parent_rel = RelationIdGetRelation(parent_relid);
386-
cscan->scan.plan.targetlist = pfilter_build_tlist(parent_rel,
387-
subplan->targetlist);
395+
cscan->scan.plan.targetlist = pfilter_build_tlist(parent_rel, subplan->targetlist);
388396
RelationClose(parent_rel);
389397

390-
/* No relation will be scanned */
398+
/* No physical relation will be scanned */
391399
cscan->scan.scanrelid = 0;
392400
cscan->custom_scan_tlist = subplan->targetlist;
393401

0 commit comments

Comments
 (0)