aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeIndexscan.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/executor/nodeIndexscan.c')
-rw-r--r--src/backend/executor/nodeIndexscan.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c
index bf16cb1b57e..3143bd94ec4 100644
--- a/src/backend/executor/nodeIndexscan.c
+++ b/src/backend/executor/nodeIndexscan.c
@@ -967,9 +967,20 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
Oid orderbyop = lfirst_oid(lco);
Node *orderbyexpr = (Node *) lfirst(lcx);
Oid orderbyType = exprType(orderbyexpr);
+ Oid orderbyColl = exprCollation(orderbyexpr);
+ SortSupport orderbysort = &indexstate->iss_SortSupport[i];
+
+ /* Initialize sort support */
+ orderbysort->ssup_cxt = CurrentMemoryContext;
+ orderbysort->ssup_collation = orderbyColl;
+ /* See cmp_orderbyvals() comments on NULLS LAST */
+ orderbysort->ssup_nulls_first = false;
+ /* ssup_attno is unused here and elsewhere */
+ orderbysort->ssup_attno = 0;
+ /* No abbreviation */
+ orderbysort->abbreviate = false;
+ PrepareSortSupportFromOrderingOp(orderbyop, orderbysort);
- PrepareSortSupportFromOrderingOp(orderbyop,
- &indexstate->iss_SortSupport[i]);
get_typlenbyval(orderbyType,
&indexstate->iss_OrderByTypLens[i],
&indexstate->iss_OrderByTypByVals[i]);