Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs

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);


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


pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group