From cef82eda1464193ab84a58610a388572d456c8c5 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Tue, 15 Oct 2019 10:40:13 -0700 Subject: Fix CLUSTER on expression indexes. Since the introduction of different slot types, in 1a0586de3657, we create a virtual slot in tuplesort_begin_cluster(). While that looks right, it unfortunately doesn't actually work, as ExecStoreHeapTuple() is used to store tuples in the slot. Unfortunately no regression tests for CLUSTER on expression indexes existed so far. Fix the slot type, and add bare bones tests for CLUSTER on expression indexes. Reported-By: Justin Pryzby Author: Andres Freund Discussion: https://postgr.es/m/20191011210320.GS10470@telsasoft.com Backpatch: 12, like 1a0586de3657 --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/backend') diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index ab55e69975c..a507bd24984 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -933,7 +933,7 @@ tuplesort_begin_cluster(TupleDesc tupDesc, * scantuple has to point to that slot, too. */ state->estate = CreateExecutorState(); - slot = MakeSingleTupleTableSlot(tupDesc, &TTSOpsVirtual); + slot = MakeSingleTupleTableSlot(tupDesc, &TTSOpsHeapTuple); econtext = GetPerTupleExprContext(state->estate); econtext->ecxt_scantuple = slot; } -- cgit v1.2.3