Attached is a patch that implements <> for the tid type. This is based
on a patch submitted by Mark Kirkwood in October of 2005. I added some
regression tests, avoided unnecessarily renumbering a few OIDs in the
system catalogs, and bumped the catversion.
Barring any objections I'll apply this tomorrow.
-Neil
#
# old_revision [83f728c74104003183f93dfd880cf6a1cd78aa4e]
#
# patch "src/backend/utils/adt/tid.c"
# from [63fd66f6ca6cf2202985ed43568b1278d3ffe788]
# to [b0397aaf4f48a48bc8df6d9527b2e6efff4bb314]
#
# patch "src/include/catalog/catversion.h"
# from [8777a25a1299149038960d78fb4eb4ad82dd84dd]
# to [bc85b6b3270e2a35fee9ffb421d61ea5cd3803ea]
#
# patch "src/include/catalog/pg_operator.h"
# from [6023a2b584710e36ba6db3ddaabe3299de92e2be]
# to [4ee2d8d4120a2bdde36e172f9037de1f683eb13c]
#
# patch "src/include/catalog/pg_proc.h"
# from [46d82dbe540519c81fee78230aceb97aaf835058]
# to [55d99532f4f722fca26b2da58899a1e33eb1beec]
#
# patch "src/include/utils/builtins.h"
# from [311f5e18df9c5227b1aef513f74332ba93ff7056]
# to [4fd23a0d59081264dd745f2a5355a306662b3a0e]
#
# patch "src/test/regress/expected/transactions.out"
# from [a378552d407e59c73db5d1e2236fbe3be0e6eb07]
# to [8d2ddef833ecbf835013d702b6c5d61b114e5198]
#
# patch "src/test/regress/sql/transactions.sql"
# from [8579b939a38242de1997048f46ec036ca90c5477]
# to [130236928248fbe514c3777591773d5efa27f364]
#
============================================================
*** src/backend/utils/adt/tid.c 63fd66f6ca6cf2202985ed43568b1278d3ffe788
--- src/backend/utils/adt/tid.c b0397aaf4f48a48bc8df6d9527b2e6efff4bb314
***************
*** 174,180 ****
arg1->ip_posid == arg2->ip_posid);
}
- #ifdef NOT_USED
Datum
tidne(PG_FUNCTION_ARGS)
{
--- 174,179 ----
***************
*** 185,191 ****
BlockIdGetBlockNumber(&(arg2->ip_blkid)) ||
arg1->ip_posid != arg2->ip_posid);
}
- #endif
/*
* Functions to get latest tid of a specified tuple.
--- 184,189 ----
============================================================
*** src/include/catalog/catversion.h 8777a25a1299149038960d78fb4eb4ad82dd84dd
--- src/include/catalog/catversion.h bc85b6b3270e2a35fee9ffb421d61ea5cd3803ea
***************
*** 53,58 ****
*/
/* yyyymmddN */
! #define CATALOG_VERSION_NO 200602112
#endif
--- 53,58 ----
*/
/* yyyymmddN */
! #define CATALOG_VERSION_NO 200602251
#endif
============================================================
*** src/include/catalog/pg_operator.h 6023a2b584710e36ba6db3ddaabe3299de92e2be
--- src/include/catalog/pg_operator.h 4ee2d8d4120a2bdde36e172f9037de1f683eb13c
***************
*** 130,135 ****
--- 130,136 ----
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 0 0 0 0 0 tideq eqsel eqjoinsel ));
#define TIDEqualOperator 387
+ DATA(insert OID = 402 ( "<>" PGNSP PGUID b f 27 27 16 402 0 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 ));
============================================================
*** src/include/catalog/pg_proc.h 46d82dbe540519c81fee78230aceb97aaf835058
--- src/include/catalog/pg_proc.h 55d99532f4f722fca26b2da58899a1e33eb1beec
***************
*** 1598,1603 ****
--- 1598,1605 ----
DESCR("latest tid of a tuple");
DATA(insert OID = 1294 ( currtid2 PGNSP PGUID 12 f f t f v 2 27 "25 27" _null_ _null_ _null_ currtid_byrelname - _null_ ));
DESCR("latest tid of a tuple");
+ DATA(insert OID = 2398 ( tidne PGNSP PGUID 12 f f t f i 2 16 "27 27" _null_ _null_ _null_ tidne - _null_ ));
+ DESCR("not equal");
DATA(insert OID = 2168 ( pg_database_size PGNSP PGUID 12 f f t f v 1 20 "19" _null_ _null_ _null_ pg_database_size_name - _null_ ));
DESCR("Calculate total disk space usage for the specified database");
============================================================
*** src/include/utils/builtins.h 311f5e18df9c5227b1aef513f74332ba93ff7056
--- src/include/utils/builtins.h 4fd23a0d59081264dd745f2a5355a306662b3a0e
***************
*** 531,536 ****
--- 531,537 ----
extern Datum tidrecv(PG_FUNCTION_ARGS);
extern Datum tidsend(PG_FUNCTION_ARGS);
extern Datum tideq(PG_FUNCTION_ARGS);
+ extern Datum tidne(PG_FUNCTION_ARGS);
extern Datum currtid_byreloid(PG_FUNCTION_ARGS);
extern Datum currtid_byrelname(PG_FUNCTION_ARGS);
============================================================
*** src/test/regress/expected/transactions.out a378552d407e59c73db5d1e2236fbe3be0e6eb07
--- src/test/regress/expected/transactions.out 8d2ddef833ecbf835013d702b6c5d61b114e5198
***************
*** 517,519 ****
--- 517,544 ----
(1 row)
abort;
+ -- tests for the "tid" type
+ SELECT '(3, 3)'::tid = '(3, 4)'::tid;
+ ?column?
+ ----------
+ f
+ (1 row)
+
+ SELECT '(3, 3)'::tid = '(3, 3)'::tid;
+ ?column?
+ ----------
+ t
+ (1 row)
+
+ SELECT '(3, 3)'::tid <> '(3, 3)'::tid;
+ ?column?
+ ----------
+ f
+ (1 row)
+
+ SELECT '(3, 3)'::tid <> '(3, 4)'::tid;
+ ?column?
+ ----------
+ t
+ (1 row)
+
============================================================
*** src/test/regress/sql/transactions.sql 8579b939a38242de1997048f46ec036ca90c5477
--- src/test/regress/sql/transactions.sql 130236928248fbe514c3777591773d5efa27f364
***************
*** 325,327 ****
--- 325,333 ----
fetch from foo;
abort;
+
+ -- tests for the "tid" type
+ SELECT '(3, 3)'::tid = '(3, 4)'::tid;
+ SELECT '(3, 3)'::tid = '(3, 3)'::tid;
+ SELECT '(3, 3)'::tid <> '(3, 3)'::tid;
+ SELECT '(3, 3)'::tid <> '(3, 4)'::tid;
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?
http://archives.postgresql.org