diff options
author | Teodor Sigaev | 2009-12-02 13:13:24 +0000 |
---|---|---|
committer | Teodor Sigaev | 2009-12-02 13:13:24 +0000 |
commit | aebc4e67fffc89a0cf933b9617316b7019318db4 (patch) | |
tree | 81010843c02750bb9142142876598ae62cce2698 /contrib/btree_gist/btree_macaddr.c | |
parent | 59ed94ad0c9f74a3f057f359316c845cedc4461e (diff) |
Preventing intersection of ranges during page split. Changes are only
optimization, so don't backpatch.
Diffstat (limited to 'contrib/btree_gist/btree_macaddr.c')
-rw-r--r-- | contrib/btree_gist/btree_macaddr.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/contrib/btree_gist/btree_macaddr.c b/contrib/btree_gist/btree_macaddr.c index 5c5030faecc..2683e1454cf 100644 --- a/contrib/btree_gist/btree_macaddr.c +++ b/contrib/btree_gist/btree_macaddr.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_macaddr.c,v 1.8 2009/06/11 14:48:50 momjian Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_macaddr.c,v 1.9 2009/12/02 13:13:24 teodor Exp $ */ #include "btree_gist.h" #include "btree_utils_num.h" @@ -63,13 +63,15 @@ gbt_macadlt(const void *a, const void *b) static int gbt_macadkey_cmp(const void *a, const void *b) { - return DatumGetInt32( - DirectFunctionCall2( - macaddr_cmp, - PointerGetDatum(&((Nsrt *) a)->t[0]), - PointerGetDatum(&((Nsrt *) b)->t[0]) - ) - ); + macKEY *ia = (macKEY*)(((Nsrt *) a)->t); + macKEY *ib = (macKEY*)(((Nsrt *) b)->t); + int res; + + res = DatumGetInt32(DirectFunctionCall2(macaddr_cmp, MacaddrPGetDatum(&ia->lower), MacaddrPGetDatum(&ib->lower))); + if (res == 0) + return DatumGetInt32(DirectFunctionCall2(macaddr_cmp, MacaddrPGetDatum(&ia->upper), MacaddrPGetDatum(&ib->upper))); + + return res; } |