diff options
Diffstat (limited to 'contrib/btree_gist/btree_oid.c')
-rw-r--r-- | contrib/btree_gist/btree_oid.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/contrib/btree_gist/btree_oid.c b/contrib/btree_gist/btree_oid.c index 6a0805635df..11327c29be4 100644 --- a/contrib/btree_gist/btree_oid.c +++ b/contrib/btree_gist/btree_oid.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_oid.c,v 1.8 2009/06/11 14:48:50 momjian Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_oid.c,v 1.9 2009/12/02 13:13:24 teodor Exp $ */ #include "btree_gist.h" #include "btree_utils_num.h" @@ -57,13 +57,18 @@ gbt_oidlt(const void *a, const void *b) static int gbt_oidkey_cmp(const void *a, const void *b) { + oidKEY *ia = (oidKEY*)(((Nsrt *) a)->t); + oidKEY *ib = (oidKEY*)(((Nsrt *) b)->t); - if (*(Oid *) &(((Nsrt *) a)->t[0]) > *(Oid *) &(((Nsrt *) b)->t[0])) - return 1; - else if (*(Oid *) &(((Nsrt *) a)->t[0]) < *(Oid *) &(((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; } |