Index: src/backend/utils/adt/tid.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/tid.c,v retrieving revision 1.52 diff -c -p -c -r1.52 tid.c *** src/backend/utils/adt/tid.c 5 Mar 2006 15:58:44 -0000 1.52 --- src/backend/utils/adt/tid.c 6 Jul 2006 22:46:18 -0000 *************** tidsend(PG_FUNCTION_ARGS) *** 164,178 **** * PUBLIC ROUTINES * *****************************************************************************/ Datum tideq(PG_FUNCTION_ARGS) { ItemPointer arg1 = PG_GETARG_ITEMPOINTER(0); ItemPointer arg2 = PG_GETARG_ITEMPOINTER(1); ! PG_RETURN_BOOL(BlockIdGetBlockNumber(&(arg1->ip_blkid)) == ! BlockIdGetBlockNumber(&(arg2->ip_blkid)) && ! arg1->ip_posid == arg2->ip_posid); } Datum --- 164,194 ---- * PUBLIC ROUTINES * *****************************************************************************/ + static int + tid_cmp_internal(ItemPointer arg1, ItemPointer arg2) + { + BlockNumber b1 = BlockIdGetBlockNumber(&(arg1->ip_blkid)); + BlockNumber b2 = BlockIdGetBlockNumber(&(arg2->ip_blkid)); + + if (b1 < b2) + return -1; + else if (b1 > b2) + return 1; + else if (arg1->ip_posid < arg2->ip_posid) + return -1; + else if (arg1->ip_posid > arg2->ip_posid) + return 1; + else + return 0; + } + Datum tideq(PG_FUNCTION_ARGS) { ItemPointer arg1 = PG_GETARG_ITEMPOINTER(0); ItemPointer arg2 = PG_GETARG_ITEMPOINTER(1); ! PG_RETURN_BOOL(tid_cmp_internal(arg1,arg2) == 0); } Datum *************** tidne(PG_FUNCTION_ARGS) *** 181,191 **** ItemPointer arg1 = PG_GETARG_ITEMPOINTER(0); ItemPointer arg2 = PG_GETARG_ITEMPOINTER(1); ! PG_RETURN_BOOL(BlockIdGetBlockNumber(&(arg1->ip_blkid)) != ! BlockIdGetBlockNumber(&(arg2->ip_blkid)) || ! arg1->ip_posid != arg2->ip_posid); } /* * Functions to get latest tid of a specified tuple. * --- 197,252 ---- ItemPointer arg1 = PG_GETARG_ITEMPOINTER(0); ItemPointer arg2 = PG_GETARG_ITEMPOINTER(1); ! PG_RETURN_BOOL(tid_cmp_internal(arg1,arg2) != 0); ! } ! ! Datum ! tidlt(PG_FUNCTION_ARGS) ! { ! ItemPointer arg1 = PG_GETARG_ITEMPOINTER(0); ! ItemPointer arg2 = PG_GETARG_ITEMPOINTER(1); ! ! PG_RETURN_BOOL(tid_cmp_internal(arg1,arg2) == -1); } + Datum + tidle(PG_FUNCTION_ARGS) + { + ItemPointer arg1 = PG_GETARG_ITEMPOINTER(0); + ItemPointer arg2 = PG_GETARG_ITEMPOINTER(1); + + PG_RETURN_BOOL(tid_cmp_internal(arg1,arg2) <= 0); + } + + Datum + tidgt(PG_FUNCTION_ARGS) + { + ItemPointer arg1 = PG_GETARG_ITEMPOINTER(0); + ItemPointer arg2 = PG_GETARG_ITEMPOINTER(1); + + PG_RETURN_BOOL(tid_cmp_internal(arg1,arg2) == 1); + } + + Datum + tidge(PG_FUNCTION_ARGS) + { + ItemPointer arg1 = PG_GETARG_ITEMPOINTER(0); + ItemPointer arg2 = PG_GETARG_ITEMPOINTER(1); + + PG_RETURN_BOOL(tid_cmp_internal(arg1,arg2) >= 0); + } + + Datum + bttidcmp(PG_FUNCTION_ARGS) + { + ItemPointer arg1 = PG_GETARG_ITEMPOINTER(0); + ItemPointer arg2 = PG_GETARG_ITEMPOINTER(1); + + PG_RETURN_INT32(tid_cmp_internal(arg1, arg2)); + } + + + /* * Functions to get latest tid of a specified tuple. * Index: src/include/catalog/catversion.h =================================================================== RCS file: /projects/cvsroot/pgsql/src/include/catalog/catversion.h,v retrieving revision 1.336 diff -c -p -c -r1.336 catversion.h *** src/include/catalog/catversion.h 3 Jul 2006 22:45:40 -0000 1.336 --- src/include/catalog/catversion.h 6 Jul 2006 22:46:19 -0000 *************** *** 53,58 **** */ /* yyyymmddN */ ! #define CATALOG_VERSION_NO 200607021 #endif --- 53,58 ---- */ /* yyyymmddN */ ! #define CATALOG_VERSION_NO 200607061 #endif Index: src/include/catalog/pg_amop.h =================================================================== RCS file: /projects/cvsroot/pgsql/src/include/catalog/pg_amop.h,v retrieving revision 1.71 diff -c -p -c -r1.71 pg_amop.h *** src/include/catalog/pg_amop.h 2 May 2006 15:23:16 -0000 1.71 --- src/include/catalog/pg_amop.h 6 Jul 2006 22:46:19 -0000 *************** DATA(insert ( 1989 0 4 f 612 )); *** 157,162 **** --- 157,172 ---- DATA(insert ( 1989 0 5 f 610 )); /* + * btree tid_ops + */ + + DATA(insert ( 2785 0 1 f 2786 )); + DATA(insert ( 2785 0 2 f 2788 )); + DATA(insert ( 2785 0 3 f 387 )); + DATA(insert ( 2785 0 4 f 2789 )); + DATA(insert ( 2785 0 5 f 2787 )); + + /* * btree oidvector_ops */ Index: src/include/catalog/pg_amproc.h =================================================================== RCS file: /projects/cvsroot/pgsql/src/include/catalog/pg_amproc.h,v retrieving revision 1.58 diff -c -p -c -r1.58 pg_amproc.h *** src/include/catalog/pg_amproc.h 2 May 2006 15:23:16 -0000 1.58 --- src/include/catalog/pg_amproc.h 6 Jul 2006 22:46:19 -0000 *************** DATA(insert ( 2098 0 1 2187 )); *** 124,130 **** DATA(insert ( 2099 0 1 377 )); DATA(insert ( 2233 0 1 380 )); DATA(insert ( 2234 0 1 381 )); ! /* hash */ DATA(insert ( 427 0 1 1080 )); --- 124,130 ---- DATA(insert ( 2099 0 1 377 )); DATA(insert ( 2233 0 1 380 )); DATA(insert ( 2234 0 1 381 )); ! DATA(insert ( 2785 0 1 2794 )); /* hash */ DATA(insert ( 427 0 1 1080 )); Index: src/include/catalog/pg_opclass.h =================================================================== RCS file: /projects/cvsroot/pgsql/src/include/catalog/pg_opclass.h,v retrieving revision 1.70 diff -c -p -c -r1.70 pg_opclass.h *** src/include/catalog/pg_opclass.h 2 May 2006 15:23:16 -0000 1.70 --- src/include/catalog/pg_opclass.h 6 Jul 2006 22:46:19 -0000 *************** DATA(insert OID = 2222 ( 405 bool_ops *** 162,167 **** --- 162,168 ---- #define BOOL_HASH_OPS_OID 2222 DATA(insert OID = 2223 ( 405 bytea_ops PGNSP PGUID 17 t 0 )); DATA(insert OID = 2224 ( 405 int2vector_ops PGNSP PGUID 22 t 0 )); + DATA(insert OID = 2785 ( 403 tid_ops PGNSP PGUID 27 t 0 )); DATA(insert OID = 2225 ( 405 xid_ops PGNSP PGUID 28 t 0 )); DATA(insert OID = 2226 ( 405 cid_ops PGNSP PGUID 29 t 0 )); DATA(insert OID = 2227 ( 405 abstime_ops PGNSP PGUID 702 t 0 )); *************** DATA(insert OID = 2778 ( 2742 _money_ops *** 207,210 **** --- 208,212 ---- DATA(insert OID = 2779 ( 2742 _reltime_ops PGNSP PGUID 1024 t 703 )); DATA(insert OID = 2780 ( 2742 _tinterval_ops PGNSP PGUID 1025 t 704 )); + #endif /* PG_OPCLASS_H */ Index: src/include/catalog/pg_operator.h =================================================================== RCS file: /projects/cvsroot/pgsql/src/include/catalog/pg_operator.h,v retrieving revision 1.143 diff -c -p -c -r1.143 pg_operator.h *** src/include/catalog/pg_operator.h 2 May 2006 11:28:55 -0000 1.143 --- src/include/catalog/pg_operator.h 6 Jul 2006 22:46:19 -0000 *************** DATA(insert OID = 388 ( "!" PGNSP PG *** 128,136 **** DATA(insert OID = 389 ( "!!" PGNSP PGUID l f 0 20 1700 0 0 0 0 0 0 numeric_fac - - )); DATA(insert OID = 385 ( "=" PGNSP PGUID b t 29 29 16 385 0 0 0 0 0 cideq eqsel eqjoinsel )); DATA(insert OID = 386 ( "=" PGNSP PGUID b t 22 22 16 386 0 0 0 0 0 int2vectoreq eqsel eqjoinsel )); DATA(insert OID = 387 ( "=" PGNSP PGUID b f 27 27 16 387 402 0 0 0 0 tideq eqsel eqjoinsel )); #define TIDEqualOperator 387 ! DATA(insert OID = 402 ( "<>" PGNSP PGUID b f 27 27 16 402 387 0 0 0 0 tidne neqsel neqjoinsel )); DATA(insert OID = 410 ( "=" PGNSP PGUID b t 20 20 16 410 411 412 412 412 413 int8eq eqsel eqjoinsel )); DATA(insert OID = 411 ( "<>" PGNSP PGUID b f 20 20 16 411 410 0 0 0 0 int8ne neqsel neqjoinsel )); --- 128,141 ---- DATA(insert OID = 389 ( "!!" PGNSP PGUID l f 0 20 1700 0 0 0 0 0 0 numeric_fac - - )); DATA(insert OID = 385 ( "=" PGNSP PGUID b t 29 29 16 385 0 0 0 0 0 cideq eqsel eqjoinsel )); DATA(insert OID = 386 ( "=" PGNSP PGUID b t 22 22 16 386 0 0 0 0 0 int2vectoreq eqsel eqjoinsel )); + DATA(insert OID = 387 ( "=" PGNSP PGUID b f 27 27 16 387 402 0 0 0 0 tideq eqsel eqjoinsel )); #define TIDEqualOperator 387 ! DATA(insert OID = 402 ( "<>" PGNSP PGUID b f 27 27 16 402 387 0 0 0 0 tidne neqsel neqjoinsel )); ! DATA(insert OID = 2786 ( "<" PGNSP PGUID b f 27 27 16 2787 2789 0 0 0 0 tidlt scalarltsel scalarltjoinsel )); ! DATA(insert OID = 2787 ( ">" PGNSP PGUID b f 27 27 16 2786 2788 0 0 0 0 tidgt scalargtsel scalargtjoinsel )); ! DATA(insert OID = 2788 ( "<=" PGNSP PGUID b f 27 27 16 2789 2787 0 0 0 0 tidle scalarltsel scalarltjoinsel )); ! DATA(insert OID = 2789 ( ">=" PGNSP PGUID b f 27 27 16 2788 2786 0 0 0 0 tidge scalargtsel scalargtjoinsel )); DATA(insert OID = 410 ( "=" PGNSP PGUID b t 20 20 16 410 411 412 412 412 413 int8eq eqsel eqjoinsel )); DATA(insert OID = 411 ( "<>" PGNSP PGUID b f 20 20 16 411 410 0 0 0 0 int8ne neqsel neqjoinsel )); *************** DATA(insert OID = 596 ( "|/" PGNSP P *** 262,267 **** --- 267,273 ---- DATA(insert OID = 597 ( "||/" PGNSP PGUID l f 0 701 701 0 0 0 0 0 0 dcbrt - - )); DATA(insert OID = 1284 ( "|" PGNSP PGUID l f 0 704 702 0 0 0 0 0 0 tintervalstart - - )); DATA(insert OID = 606 ( "<#>" PGNSP PGUID b f 702 702 704 0 0 0 0 0 0 mktinterval - - )); + DATA(insert OID = 607 ( "=" PGNSP PGUID b t 26 26 16 607 608 609 609 609 610 oideq eqsel eqjoinsel )); #define MIN_OIDCMP 607 /* used by cache code */ DATA(insert OID = 608 ( "<>" PGNSP PGUID b f 26 26 16 608 607 0 0 0 0 oidne neqsel neqjoinsel )); Index: src/include/catalog/pg_proc.h =================================================================== RCS file: /projects/cvsroot/pgsql/src/include/catalog/pg_proc.h,v retrieving revision 1.415 diff -c -p -c -r1.415 pg_proc.h *** src/include/catalog/pg_proc.h 3 Jul 2006 22:45:40 -0000 1.415 --- src/include/catalog/pg_proc.h 6 Jul 2006 22:46:19 -0000 *************** DESCR("anyarray contains"); *** 3872,3877 **** --- 3872,3889 ---- DATA(insert OID = 2749 ( arraycontained PGNSP PGUID 12 f f t f i 2 16 "2277 2277" _null_ _null_ _null_ arraycontained - _null_ )); DESCR("anyarray contained"); + /* new TID functions (tideq and tidne are above) */ + DATA(insert OID = 2790 ( tidgt PGNSP PGUID 12 f f t f i 2 16 "27 27" _null_ _null_ _null_ tidgt - _null_)); + DESCR("greater-than"); + DATA(insert OID = 2791 ( tidlt PGNSP PGUID 12 f f t f i 2 16 "27 27" _null_ _null_ _null_ tidlt - _null_)); + DESCR("less-than"); + DATA(insert OID = 2792 ( tidge PGNSP PGUID 12 f f t f i 2 16 "27 27" _null_ _null_ _null_ tidge - _null_)); + DESCR("greater-than-or-equal"); + DATA(insert OID = 2793 ( tidle PGNSP PGUID 12 f f t f i 2 16 "27 27" _null_ _null_ _null_ tidle - _null_)); + DESCR("less-than-or-equal"); + DATA(insert OID = 2794 ( bttidcmp PGNSP PGUID 12 f f t f i 2 23 "27 27" _null_ _null_ _null_ bttidcmp - _null_)); + DESCR("btree less-equal-greater"); + /* * Symbolic values for provolatile column: these indicate whether the result * of a function is dependent *only* on the values of its explicit arguments, Index: src/include/utils/builtins.h =================================================================== RCS file: /projects/cvsroot/pgsql/src/include/utils/builtins.h,v retrieving revision 1.279 diff -c -p -c -r1.279 builtins.h *** src/include/utils/builtins.h 8 Apr 2006 18:49:52 -0000 1.279 --- src/include/utils/builtins.h 6 Jul 2006 22:46:19 -0000 *************** extern Datum tidrecv(PG_FUNCTION_ARGS); *** 538,543 **** --- 538,548 ---- extern Datum tidsend(PG_FUNCTION_ARGS); extern Datum tideq(PG_FUNCTION_ARGS); extern Datum tidne(PG_FUNCTION_ARGS); + extern Datum tidgt(PG_FUNCTION_ARGS); + extern Datum tidlt(PG_FUNCTION_ARGS); + extern Datum tidge(PG_FUNCTION_ARGS); + extern Datum tidle(PG_FUNCTION_ARGS); + extern Datum bttidcmp(PG_FUNCTION_ARGS); extern Datum currtid_byreloid(PG_FUNCTION_ARGS); extern Datum currtid_byrelname(PG_FUNCTION_ARGS);