From db823406cbecefb2e4b16339b96caf6392dec568 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Mon, 2 Mar 2015 17:33:40 +0000 Subject: [PATCH] Fix ND-GiST picksplit method to split on the best plane (#3058) git-svn-id: http://svn.osgeo.org/postgis/trunk@13294 b70326c6-7e19-0410-871a-916f4a2858ee --- postgis/gserialized_gist_nd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/postgis/gserialized_gist_nd.c b/postgis/gserialized_gist_nd.c index 066b780fe..bce011324 100644 --- a/postgis/gserialized_gist_nd.c +++ b/postgis/gserialized_gist_nd.c @@ -1293,7 +1293,7 @@ Datum gserialized_gist_picksplit(PG_FUNCTION_ARGS) bool all_entries_equal = true; OffsetNumber max_offset; int nbytes, ndims_pageunion, d; - int posmax = -1; + int posmin = entryvec->n; POSTGIS_DEBUG(4, "[GIST] 'picksplit' function called"); @@ -1447,13 +1447,13 @@ Datum gserialized_gist_picksplit(PG_FUNCTION_ARGS) for ( d = 0; d < ndims_pageunion; d++ ) { int posd = Max(pos[ABOVE(d)],pos[BELOW(d)]); - if ( posd > posmax ) + if ( posd < posmin ) { direction = d; - posmax = posd; + posmin = posd; } } - if ( direction == -1 || posmax == -1 ) + if ( direction == -1 || posmin == entryvec->n ) { /* ERROR OUT HERE */ elog(ERROR, "Error in building split, unable to determine split direction."); -- 2.50.1