add an assert to create_remotequery_path for RELOPT_BASEREL case
authorTomas Vondra <[email protected]>
Sun, 28 Aug 2016 02:48:11 +0000 (04:48 +0200)
committerPavan Deolasee <[email protected]>
Thu, 1 Sep 2016 09:25:19 +0000 (14:55 +0530)
Make sure that for base relations, both the paths (left and right)
and join restrictlist are NULL (or NIL for the list). I'm not sure
if this is true for RELOPT_OTHER_MEMBER_REL also, so only do this
for RELOPT_BASEREL.

Perhaps we should also convert the inverse condition (for join
relations) to an assert - currently it's an if condition:

  if (rel->reloptkind == RELOPT_JOINREL && (!leftpath || !rightpath))
    ...

but I've left that alone for now.

src/backend/optimizer/path/pgxcpath.c

index 0d2385c43bf8607077236fd5e3ac2388a27892fc..832aee965c116fc3b474c262777d811aeb55ad6c 100644 (file)
@@ -69,6 +69,17 @@ create_remotequery_path(PlannerInfo *root, RelOptInfo *rel, ExecNodes *exec_node
        switch (rel->reloptkind)
        {
                case RELOPT_BASEREL:
+
+                       /*
+                        * For baserels, the left/right path and restrictlist should be NULL.
+                        *
+                        * XXX I'm not sure if the same is true for other non-join rels, so
+                        * let's only add it for the RELOPT_BASEREL case.
+                        */
+                       Assert(leftpath == NULL && rightpath == NULL && join_restrictlist == NIL);
+
+                       /* fall-through */
+
                case RELOPT_OTHER_MEMBER_REL:
                {
                        RangeTblEntry *rte = rt_fetch(rel->relid, root->parse->rtable);