ERROR: comparetup_datum() should not be called

From: yamt(at)mwd(dot)biglobe(dot)ne(dot)jp (YAMAMOTO Takashi)
To: pgsql-bugs(at)postgresql(dot)org
Subject: ERROR: comparetup_datum() should not be called
Date: 2012-04-06 14:04:25
Message-ID: 20120406140425.49EAC14A1FA@mail.netbsd.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

hi,

commit 337b6f5ecf05b21b5e997986884d097d60e4e3d0 marked comparetup_datum
"should not be called" but actually it is called for eg. tape-based sort.

a testcase:
select generate_series(1,1000000) a into t;
set maintenance_work_mem=1024;
create index concurrently i on t (a);

YAMAMOTO Takashi

diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c
index d8e5d68..ea8eca6 100644
--- a/src/backend/utils/sort/tuplesort.c
+++ b/src/backend/utils/sort/tuplesort.c
@@ -3243,9 +3243,9 @@ reversedirection_index_hash(Tuplesortstate *state)
static int
comparetup_datum(const SortTuple *a, const SortTuple *b, Tuplesortstate *state)
{
- /* Not currently needed */
- elog(ERROR, "comparetup_datum() should not be called");
- return 0;
+ return ApplySortComparator(a->datum1, a->isnull1,
+ b->datum1, b->isnull1,
+ state->onlyKey);
}

static void

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2012-04-06 20:59:43 Re: ERROR: comparetup_datum() should not be called
Previous Message Lucian Curelaru 2012-04-06 08:05:41 Re: pg_ctl wrong status info on Windows