diff options
Diffstat (limited to 'src/backend/optimizer/path')
| -rw-r--r-- | src/backend/optimizer/path/indxpath.c | 30 | ||||
| -rw-r--r-- | src/backend/optimizer/path/orindxpath.c | 22 |
2 files changed, 24 insertions, 28 deletions
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c index 2866689b9a..db271e4f1e 100644 --- a/src/backend/optimizer/path/indxpath.c +++ b/src/backend/optimizer/path/indxpath.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.238 2009/03/11 03:32:22 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.239 2009/04/16 20:42:16 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -2325,11 +2325,7 @@ expand_indexqual_conditions(IndexOptInfo *index, List *clausegroups) if (boolqual) { resultquals = lappend(resultquals, - make_restrictinfo(boolqual, - true, - false, - false, - NULL)); + make_simple_restrictinfo(boolqual)); continue; } } @@ -2360,11 +2356,7 @@ expand_indexqual_conditions(IndexOptInfo *index, List *clausegroups) { Assert(index->amsearchnulls); resultquals = lappend(resultquals, - make_restrictinfo(clause, - true, - false, - false, - NULL)); + make_simple_restrictinfo(clause)); } else elog(ERROR, "unsupported indexqual type: %d", @@ -2737,7 +2729,7 @@ expand_indexqual_rowcompare(RestrictInfo *rinfo, matching_cols); rc->rargs = list_truncate((List *) copyObject(clause->rargs), matching_cols); - return make_restrictinfo((Expr *) rc, true, false, false, NULL); + return make_simple_restrictinfo((Expr *) rc); } else { @@ -2746,7 +2738,7 @@ expand_indexqual_rowcompare(RestrictInfo *rinfo, opexpr = make_opclause(linitial_oid(new_ops), BOOLOID, false, copyObject(linitial(clause->largs)), copyObject(linitial(clause->rargs))); - return make_restrictinfo(opexpr, true, false, false, NULL); + return make_simple_restrictinfo(opexpr); } } @@ -2832,7 +2824,7 @@ prefix_quals(Node *leftop, Oid opfamily, elog(ERROR, "no = operator for opfamily %u", opfamily); expr = make_opclause(oproid, BOOLOID, false, (Expr *) leftop, (Expr *) prefix_const); - result = list_make1(make_restrictinfo(expr, true, false, false, NULL)); + result = list_make1(make_simple_restrictinfo(expr)); return result; } @@ -2847,7 +2839,7 @@ prefix_quals(Node *leftop, Oid opfamily, elog(ERROR, "no >= operator for opfamily %u", opfamily); expr = make_opclause(oproid, BOOLOID, false, (Expr *) leftop, (Expr *) prefix_const); - result = list_make1(make_restrictinfo(expr, true, false, false, NULL)); + result = list_make1(make_simple_restrictinfo(expr)); /*------- * If we can create a string larger than the prefix, we can say @@ -2864,8 +2856,7 @@ prefix_quals(Node *leftop, Oid opfamily, { expr = make_opclause(oproid, BOOLOID, false, (Expr *) leftop, (Expr *) greaterstr); - result = lappend(result, - make_restrictinfo(expr, true, false, false, NULL)); + result = lappend(result, make_simple_restrictinfo(expr)); } return result; @@ -2928,7 +2919,7 @@ network_prefix_quals(Node *leftop, Oid expr_op, Oid opfamily, Datum rightop) (Expr *) leftop, (Expr *) makeConst(datatype, -1, -1, opr1right, false, false)); - result = list_make1(make_restrictinfo(expr, true, false, false, NULL)); + result = list_make1(make_simple_restrictinfo(expr)); /* create clause "key <= network_scan_last( rightop )" */ @@ -2943,8 +2934,7 @@ network_prefix_quals(Node *leftop, Oid expr_op, Oid opfamily, Datum rightop) (Expr *) leftop, (Expr *) makeConst(datatype, -1, -1, opr2right, false, false)); - result = lappend(result, - make_restrictinfo(expr, true, false, false, NULL)); + result = lappend(result, make_simple_restrictinfo(expr)); return result; } diff --git a/src/backend/optimizer/path/orindxpath.c b/src/backend/optimizer/path/orindxpath.c index 2f8a67394e..c84591fe0c 100644 --- a/src/backend/optimizer/path/orindxpath.c +++ b/src/backend/optimizer/path/orindxpath.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/path/orindxpath.c,v 1.88 2009/02/15 20:16:21 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/path/orindxpath.c,v 1.89 2009/04/16 20:42:16 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -89,12 +89,18 @@ create_or_index_quals(PlannerInfo *root, RelOptInfo *rel) ListCell *i; /* - * Find potentially interesting OR joinclauses. Note we must ignore any - * joinclauses that are marked outerjoin_delayed or !is_pushed_down, - * because they cannot be pushed down to the per-relation level due to - * outer-join rules. (XXX in some cases it might be possible to allow - * this, but it would require substantially more bookkeeping about where - * the clause came from.) + * Find potentially interesting OR joinclauses. + * + * We must ignore clauses for which the target rel is in nullable_relids; + * that means there's an outer join below the clause and so it can't be + * enforced at the relation scan level. + * + * We must also ignore clauses that are marked !is_pushed_down (ie they + * are themselves outer-join clauses). It would be safe to extract an + * index condition from such a clause if we are within the nullable rather + * than the non-nullable side of its join, but we haven't got enough + * context here to tell which applies. OR clauses in outer-join quals + * aren't exactly common, so we'll let that case go unoptimized for now. */ foreach(i, rel->joininfo) { @@ -102,7 +108,7 @@ create_or_index_quals(PlannerInfo *root, RelOptInfo *rel) if (restriction_is_or_clause(rinfo) && rinfo->is_pushed_down && - !rinfo->outerjoin_delayed) + !bms_is_member(rel->relid, rinfo->nullable_relids)) { /* * Use the generate_bitmap_or_paths() machinery to estimate the |
