diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-03-19 20:29:08 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-03-19 20:30:08 -0400 |
commit | b310b6e31ce5aa9e456c43c0e8e93248b0c84c02 (patch) | |
tree | e5168fcfdb231a9889e87e309f38a9e0f05a7896 /src/backend/executor/nodeIndexscan.c | |
parent | 025f4c72f029242a6aaf3f14bb6d7da4ce070f72 (diff) | |
download | postgresql-b310b6e31ce5aa9e456c43c0e8e93248b0c84c02.tar.gz postgresql-b310b6e31ce5aa9e456c43c0e8e93248b0c84c02.zip |
Revise collation derivation method and expression-tree representation.
All expression nodes now have an explicit output-collation field, unless
they are known to only return a noncollatable data type (such as boolean
or record). Also, nodes that can invoke collation-aware functions store
a separate field that is the collation value to pass to the function.
This avoids confusion that arises when a function has collatable inputs
and noncollatable output type, or vice versa.
Also, replace the parser's on-the-fly collation assignment method with
a post-pass over the completed expression tree. This allows us to use
a more complex (and hopefully more nearly spec-compliant) assignment
rule without paying for it in extra storage in every expression node.
Fix assorted bugs in the planner's handling of collations by making
collation one of the defining properties of an EquivalenceClass and
by converting CollateExprs into discardable RelabelType nodes during
expression preprocessing.
Diffstat (limited to 'src/backend/executor/nodeIndexscan.c')
-rw-r--r-- | src/backend/executor/nodeIndexscan.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c index 55fce94b321..e60db7813a4 100644 --- a/src/backend/executor/nodeIndexscan.c +++ b/src/backend/executor/nodeIndexscan.c @@ -732,7 +732,6 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, Index scanrelid, int op_strategy; /* operator's strategy number */ Oid op_lefttype; /* operator's declared input types */ Oid op_righttype; - Oid collation; Expr *leftop; /* expr on lhs of operator */ Expr *rightop; /* expr on rhs ... */ AttrNumber varattno; /* att number used in scan */ @@ -833,7 +832,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, Index scanrelid, opfuncid, /* reg proc to use */ scanvalue); /* constant */ ScanKeyEntryInitializeCollation(this_scan_key, - ((OpExpr *) clause)->collid); + ((OpExpr *) clause)->inputcollid); } else if (IsA(clause, RowCompareExpr)) { @@ -842,7 +841,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, Index scanrelid, ListCell *largs_cell = list_head(rc->largs); ListCell *rargs_cell = list_head(rc->rargs); ListCell *opnos_cell = list_head(rc->opnos); - ListCell *collids_cell = list_head(rc->collids); + ListCell *collids_cell = list_head(rc->inputcollids); ScanKey first_sub_key; int n_sub_key; @@ -858,6 +857,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, Index scanrelid, ScanKey this_sub_key = &first_sub_key[n_sub_key]; int flags = SK_ROW_MEMBER; Datum scanvalue; + Oid inputcollation; /* * leftop should be the index key Var, possibly relabeled @@ -901,7 +901,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, Index scanrelid, op_righttype, BTORDER_PROC); - collation = lfirst_oid(collids_cell); + inputcollation = lfirst_oid(collids_cell); collids_cell = lnext(collids_cell); /* @@ -960,7 +960,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, Index scanrelid, opfuncid, /* reg proc to use */ scanvalue); /* constant */ ScanKeyEntryInitializeCollation(this_sub_key, - collation); + inputcollation); n_sub_key++; } @@ -1045,7 +1045,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, Index scanrelid, opfuncid, /* reg proc to use */ (Datum) 0); /* constant */ ScanKeyEntryInitializeCollation(this_scan_key, - saop->collid); + saop->inputcollid); } else if (IsA(clause, NullTest)) { |