mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Preventing intersection of ranges during page split. Changes are only
optimization, so don't backpatch.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $PostgreSQL: pgsql/contrib/btree_gist/btree_time.c,v 1.16 2009/06/11 14:48:50 momjian Exp $
|
||||
* $PostgreSQL: pgsql/contrib/btree_gist/btree_time.c,v 1.17 2009/12/02 13:13:24 teodor Exp $
|
||||
*/
|
||||
#include "btree_gist.h"
|
||||
#include "btree_utils_num.h"
|
||||
@ -101,11 +101,15 @@ gbt_timelt(const void *a, const void *b)
|
||||
static int
|
||||
gbt_timekey_cmp(const void *a, const void *b)
|
||||
{
|
||||
if (gbt_timegt((void *) &(((Nsrt *) a)->t[0]), (void *) &(((Nsrt *) b)->t[0])))
|
||||
return 1;
|
||||
else if (gbt_timelt((void *) &(((Nsrt *) a)->t[0]), (void *) &(((Nsrt *) b)->t[0])))
|
||||
return -1;
|
||||
return 0;
|
||||
timeKEY *ia = (timeKEY*)(((Nsrt *) a)->t);
|
||||
timeKEY *ib = (timeKEY*)(((Nsrt *) b)->t);
|
||||
int res;
|
||||
|
||||
res = DatumGetInt32(DirectFunctionCall2(time_cmp, TimeADTGetDatumFast(ia->lower), TimeADTGetDatumFast(ib->lower)));
|
||||
if (res == 0)
|
||||
return DatumGetInt32(DirectFunctionCall2(time_cmp, TimeADTGetDatumFast(ia->upper), TimeADTGetDatumFast(ib->upper)));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user