1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

Preventing intersection of ranges during page split. Changes are only

optimization, so don't backpatch.
This commit is contained in:
Teodor Sigaev
2009-12-02 13:13:24 +00:00
parent 59ed94ad0c
commit aebc4e67ff
14 changed files with 145 additions and 83 deletions

View File

@ -1,5 +1,5 @@
/*
* $PostgreSQL: pgsql/contrib/btree_gist/btree_date.c,v 1.7 2009/06/11 14:48:50 momjian Exp $
* $PostgreSQL: pgsql/contrib/btree_gist/btree_date.c,v 1.8 2009/12/02 13:13:24 teodor Exp $
*/
#include "btree_gist.h"
#include "btree_utils_num.h"
@ -73,11 +73,15 @@ gbt_datelt(const void *a, const void *b)
static int
gbt_datekey_cmp(const void *a, const void *b)
{
if (gbt_dategt((void *) &(((Nsrt *) a)->t[0]), (void *) &(((Nsrt *) b)->t[0])))
return 1;
else if (gbt_datelt((void *) &(((Nsrt *) a)->t[0]), (void *) &(((Nsrt *) b)->t[0])))
return -1;
return 0;
dateKEY *ia = (dateKEY*)(((Nsrt *) a)->t);
dateKEY *ib = (dateKEY*)(((Nsrt *) b)->t);
int res;
res = DatumGetInt32(DirectFunctionCall2(date_cmp, DateADTGetDatum(ia->lower), DateADTGetDatum(ib->lower)));
if (res == 0)
return DatumGetInt32(DirectFunctionCall2(date_cmp, DateADTGetDatum(ia->upper), DateADTGetDatum(ib->upper)));
return res;
}