]> granicus.if.org Git - postgresql/commitdiff
Add "xid <> xid" and "xid <> int4" operators.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 7 Nov 2015 21:40:15 +0000 (16:40 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 7 Nov 2015 21:40:15 +0000 (16:40 -0500)
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
src/include/catalog/catversion.h
src/include/catalog/pg_operator.h
src/include/catalog/pg_proc.h
src/include/utils/builtins.h
src/test/regress/expected/opr_sanity.out

index 6b617653b7027bee7691a44db5f2123ab411281c..c93ff4da737065115f4a793048368d5a86751f26 100644 (file)
@@ -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)
  */
index 15e0b97a6a1f31bcd01bc15a36f0c84fcbe810f1..eba4150a1cbccbb2206118cd64c3ef02c5497639 100644 (file)
@@ -53,6 +53,6 @@
  */
 
 /*                                                     yyyymmddN */
-#define CATALOG_VERSION_NO     201510161
+#define CATALOG_VERSION_NO     201511071
 
 #endif
index eec9c60c505a3ec8611872cf52fbff46bee3330b..e79ce57f6ebfa0bc3b5873ae160f9e5ce2042b70 100644 (file)
@@ -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 - - ));
index 26d189f561f61bd7529bf6b1336bae6a276d4b1c..d8640db1454b88f72ad61706c1733c91b70bbb4c 100644 (file)
@@ -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_ ));
 
index 130f5e23bcd48e8908bb1032e66333c6510d83a2..e610bf305d420e2f5c10629ea357c023e2659a73 100644 (file)
@@ -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);
index df29fe503ecd6e7a04d2a3a48bfbf150a698ad84..7c93b3b4ca5febaf87acccf59282a7c20338108a 100644 (file)
@@ -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