From c5e86ea932794051d2fe3bd26ce4c03981b0b826 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 7 Nov 2015 16:40:15 -0500 Subject: [PATCH] Add "xid <> xid" and "xid <> int4" operators. The corresponding "=" operators have been there a long time, and not having their negators is a bit of a nuisance. Michael Paquier --- src/backend/utils/adt/xid.c | 12 ++++++++++++ src/include/catalog/catversion.h | 2 +- src/include/catalog/pg_operator.h | 8 ++++++-- src/include/catalog/pg_proc.h | 2 ++ src/include/utils/builtins.h | 1 + src/test/regress/expected/opr_sanity.out | 2 ++ 6 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/backend/utils/adt/xid.c b/src/backend/utils/adt/xid.c index 6b617653b7..c93ff4da73 100644 --- a/src/backend/utils/adt/xid.c +++ b/src/backend/utils/adt/xid.c @@ -87,6 +87,18 @@ xideq(PG_FUNCTION_ARGS) PG_RETURN_BOOL(TransactionIdEquals(xid1, xid2)); } +/* + * xidneq - are two xids different? + */ +Datum +xidneq(PG_FUNCTION_ARGS) +{ + TransactionId xid1 = PG_GETARG_TRANSACTIONID(0); + TransactionId xid2 = PG_GETARG_TRANSACTIONID(1); + + PG_RETURN_BOOL(!TransactionIdEquals(xid1, xid2)); +} + /* * xid_age - compute age of an XID (relative to latest stable xid) */ diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 15e0b97a6a..eba4150a1c 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 201510161 +#define CATALOG_VERSION_NO 201511071 #endif diff --git a/src/include/catalog/pg_operator.h b/src/include/catalog/pg_operator.h index eec9c60c50..e79ce57f6e 100644 --- a/src/include/catalog/pg_operator.h +++ b/src/include/catalog/pg_operator.h @@ -144,10 +144,14 @@ DESCR("prepend element onto front of array"); DATA(insert OID = 375 ( "||" PGNSP PGUID b f f 2277 2277 2277 0 0 array_cat - - )); DESCR("concatenate"); -DATA(insert OID = 352 ( "=" PGNSP PGUID b f t 28 28 16 352 0 xideq eqsel eqjoinsel )); +DATA(insert OID = 352 ( "=" PGNSP PGUID b f t 28 28 16 352 3315 xideq eqsel eqjoinsel )); DESCR("equal"); -DATA(insert OID = 353 ( "=" PGNSP PGUID b f f 28 23 16 0 0 xideqint4 eqsel eqjoinsel )); +DATA(insert OID = 353 ( "=" PGNSP PGUID b f f 28 23 16 0 3316 xideqint4 eqsel eqjoinsel )); DESCR("equal"); +DATA(insert OID = 3315 ( "<>" PGNSP PGUID b f f 28 28 16 3315 352 xidneq neqsel neqjoinsel )); +DESCR("not equal"); +DATA(insert OID = 3316 ( "<>" PGNSP PGUID b f f 28 23 16 0 353 xidneqint4 neqsel neqjoinsel )); +DESCR("not equal"); DATA(insert OID = 388 ( "!" PGNSP PGUID r f f 20 0 1700 0 0 numeric_fac - - )); DESCR("factorial"); DATA(insert OID = 389 ( "!!" PGNSP PGUID l f f 0 20 1700 0 0 numeric_fac - - )); diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 26d189f561..d8640db145 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -212,6 +212,7 @@ DATA(insert OID = 65 ( int4eq PGNSP PGUID 12 1 0 0 0 f f f t t f i s 2 0 DATA(insert OID = 66 ( int4lt PGNSP PGUID 12 1 0 0 0 f f f t t f i s 2 0 16 "23 23" _null_ _null_ _null_ _null_ _null_ int4lt _null_ _null_ _null_ )); DATA(insert OID = 67 ( texteq PGNSP PGUID 12 1 0 0 0 f f f t t f i s 2 0 16 "25 25" _null_ _null_ _null_ _null_ _null_ texteq _null_ _null_ _null_ )); DATA(insert OID = 68 ( xideq PGNSP PGUID 12 1 0 0 0 f f f t t f i s 2 0 16 "28 28" _null_ _null_ _null_ _null_ _null_ xideq _null_ _null_ _null_ )); +DATA(insert OID = 3308 ( xidneq PGNSP PGUID 12 1 0 0 0 f f f t t f i s 2 0 16 "28 28" _null_ _null_ _null_ _null_ _null_ xidneq _null_ _null_ _null_ )); DATA(insert OID = 69 ( cideq PGNSP PGUID 12 1 0 0 0 f f f t t f i s 2 0 16 "29 29" _null_ _null_ _null_ _null_ _null_ cideq _null_ _null_ _null_ )); DATA(insert OID = 70 ( charne PGNSP PGUID 12 1 0 0 0 f f f t t f i s 2 0 16 "18 18" _null_ _null_ _null_ _null_ _null_ charne _null_ _null_ _null_ )); DATA(insert OID = 1246 ( charlt PGNSP PGUID 12 1 0 0 0 f f f t t f i s 2 0 16 "18 18" _null_ _null_ _null_ _null_ _null_ charlt _null_ _null_ _null_ )); @@ -1515,6 +1516,7 @@ DATA(insert OID = 1318 ( length PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 2 DESCR("character length"); DATA(insert OID = 1319 ( xideqint4 PGNSP PGUID 12 1 0 0 0 f f f t t f i s 2 0 16 "28 23" _null_ _null_ _null_ _null_ _null_ xideq _null_ _null_ _null_ )); +DATA(insert OID = 3309 ( xidneqint4 PGNSP PGUID 12 1 0 0 0 f f f t t f i s 2 0 16 "28 23" _null_ _null_ _null_ _null_ _null_ xidneq _null_ _null_ _null_ )); DATA(insert OID = 1326 ( interval_div PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 1186 "1186 701" _null_ _null_ _null_ _null_ _null_ interval_div _null_ _null_ _null_ )); diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index 130f5e23bc..e610bf305d 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -860,6 +860,7 @@ extern Datum xidout(PG_FUNCTION_ARGS); extern Datum xidrecv(PG_FUNCTION_ARGS); extern Datum xidsend(PG_FUNCTION_ARGS); extern Datum xideq(PG_FUNCTION_ARGS); +extern Datum xidneq(PG_FUNCTION_ARGS); extern Datum xid_age(PG_FUNCTION_ARGS); extern Datum mxid_age(PG_FUNCTION_ARGS); extern int xidComparator(const void *arg1, const void *arg2); diff --git a/src/test/regress/expected/opr_sanity.out b/src/test/regress/expected/opr_sanity.out index df29fe503e..7c93b3b4ca 100644 --- a/src/test/regress/expected/opr_sanity.out +++ b/src/test/regress/expected/opr_sanity.out @@ -641,6 +641,8 @@ uuid_eq(uuid,uuid) uuid_ge(uuid,uuid) uuid_gt(uuid,uuid) uuid_ne(uuid,uuid) +xidneq(xid,xid) +xidneqint4(xid,integer) -- restore normal output mode \a\t -- List of functions used by libpq's fe-lobj.c -- 2.40.0