1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +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_inet.c,v 1.10 2009/06/11 14:48:50 momjian Exp $
* $PostgreSQL: pgsql/contrib/btree_gist/btree_inet.c,v 1.11 2009/12/02 13:13:24 teodor Exp $
*/
#include "btree_gist.h"
#include "btree_utils_num.h"
@ -60,13 +60,18 @@ gbt_inetlt(const void *a, const void *b)
static int
gbt_inetkey_cmp(const void *a, const void *b)
{
inetKEY *ia = (inetKEY*)(((Nsrt *) a)->t);
inetKEY *ib = (inetKEY*)(((Nsrt *) b)->t);
if (*(double *) (&((Nsrt *) a)->t[0]) > *(double *) (&((Nsrt *) b)->t[0]))
return 1;
else if (*(double *) (&((Nsrt *) a)->t[0]) < *(double *) (&((Nsrt *) b)->t[0]))
return -1;
return 0;
if (ia->lower == ib->lower)
{
if (ia->upper == ib->upper)
return 0;
return (ia->upper > ib->upper) ? 1 : -1;
}
return (ia->lower > ib->lower) ? 1 : -1;
}