On Tue, Apr 7, 2020 at 12:14 PM Thomas Munro <thomas.mu...@gmail.com> wrote:
> On Sun, Apr 5, 2020 at 11:31 AM Thomas Munro <thomas.mu...@gmail.com> wrote:
> > On Sun, Apr 5, 2020 at 10:34 AM Mark Dilger
> > <mark.dil...@enterprisedb.com> wrote:
> > > The "xid8_" warts are partly motivated by having a type named "xid8", 
> > > which is a bit of a wart in itself.
> >
> > Just a thought for the future, not sure if it's a good one: would it
> > seem less warty in years to come if we introduced xid4 as an alias for
> > xid, and preferred the name xid4?  Then it wouldn't look so much like
> > xid is the "real" transaction ID type and xid8 is some kind of freaky
> > extended version; instead it would look like xid4 and xid8 are narrow
> > and wide transaction IDs, and xid is just a historical name for xid4.
>
> I'll look into proposing that for PG14.  One reason I like that idea
> is that system view names like backend_xid could potentially retain
> their names while switching to xid8 type, (maybe?) breaking fewer
> queries and avoiding ugly names, on the theory that _xid doesn't
> specify whether it's xid4 or an xid8.

Here's a patch that renames xid to xid4, but I realised that we lack
the technology to create a suitable backwards compat alias.  The
bigint/int8 keyword trick doesn't work here, because it would break
existing queries using xid as, for example, a function argument name.
Perhaps we could invent a new kind of type that is a simple alias for
another type, and is entirely replaced by the base type early in
processing, so that you can do type aliases without bigint-style
keywords.  Perhaps all of this is not worth the churn just for a
neatnick project.
From fb6a5555f225121e667f77c16f257d58dcbf56ee Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.mu...@gmail.com>
Date: Sat, 18 Apr 2020 09:09:07 +1200
Subject: [PATCH] Rename xid to xid4.

Now that we have SQL type xid8, rename SQL type xid to xid4 for
consistency.  This makes the width of the type clearer, and avoids
creating the impression that xid is the 'real' transaction ID type,
rather than being a narrower version that lacks upper bits.

XXX Experiment only, not for commit.  To actually do this, we'd
probably want to figure out how to provide aliases like SQL xid and
C XIDOID for backwards compatibility.  It's not done in this commit,
to demonstrate that nothing in the tree depends on the old name.

XXX Documentation changes needed.
---
 src/backend/access/hash/hashvalidate.c     |  2 +-
 src/backend/access/transam/commit_ts.c     |  2 +-
 src/backend/access/transam/multixact.c     |  2 +-
 src/backend/access/transam/twophase.c      |  2 +-
 src/backend/bootstrap/bootstrap.c          |  4 +-
 src/backend/catalog/Catalog.pm             |  2 +-
 src/backend/catalog/genbki.pl              |  4 +-
 src/backend/catalog/heap.c                 |  4 +-
 src/backend/catalog/system_views.sql       |  8 +--
 src/backend/utils/adt/lockfuncs.c          |  2 +-
 src/backend/utils/adt/xid.c                | 20 +++---
 src/backend/utils/misc/pg_controldata.c    | 14 ++--
 src/fe_utils/print.c                       |  2 +-
 src/include/catalog/pg_amop.dat            |  6 +-
 src/include/catalog/pg_amproc.dat          |  8 +--
 src/include/catalog/pg_cast.dat            |  4 +-
 src/include/catalog/pg_opclass.dat         |  4 +-
 src/include/catalog/pg_operator.dat        | 18 +++---
 src/include/catalog/pg_opfamily.dat        |  2 +-
 src/include/catalog/pg_proc.dat            | 66 +++++++++----------
 src/include/catalog/pg_type.dat            |  6 +-
 src/interfaces/ecpg/ecpglib/execute.c      |  2 +-
 src/test/regress/expected/alter_table.out  |  8 +--
 src/test/regress/expected/groupingsets.out |  2 +-
 src/test/regress/expected/opr_sanity.out   |  8 +--
 src/test/regress/expected/update.out       |  4 +-
 src/test/regress/expected/xid.out          | 74 +++++++++++-----------
 src/test/regress/sql/alter_table.sql       |  8 +--
 src/test/regress/sql/groupingsets.sql      |  2 +-
 src/test/regress/sql/update.sql            |  4 +-
 src/test/regress/sql/xid.sql               | 34 +++++-----
 31 files changed, 164 insertions(+), 164 deletions(-)

diff --git a/src/backend/access/hash/hashvalidate.c b/src/backend/access/hash/hashvalidate.c
index b3d1367fec..a38fa344cb 100644
--- a/src/backend/access/hash/hashvalidate.c
+++ b/src/backend/access/hash/hashvalidate.c
@@ -315,7 +315,7 @@ check_hash_func_signature(Oid funcid, int16 amprocnum, Oid argtype)
 		 */
 		if ((funcid == F_HASHINT4 || funcid == F_HASHINT4EXTENDED) &&
 			(argtype == DATEOID ||
-			 argtype == XIDOID || argtype == CIDOID))
+			 argtype == XID4OID || argtype == CIDOID))
 			 /* okay, allowed use of hashint4() */ ;
 		else if ((funcid == F_HASHINT8 || funcid == F_HASHINT8EXTENDED) &&
 			(argtype == XID8OID))
diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c
index 630df672cc..a89d962a20 100644
--- a/src/backend/access/transam/commit_ts.c
+++ b/src/backend/access/transam/commit_ts.c
@@ -436,7 +436,7 @@ pg_last_committed_xact(PG_FUNCTION_ARGS)
 	 */
 	tupdesc = CreateTemplateTupleDesc(2);
 	TupleDescInitEntry(tupdesc, (AttrNumber) 1, "xid",
-					   XIDOID, -1, 0);
+					   XID4OID, -1, 0);
 	TupleDescInitEntry(tupdesc, (AttrNumber) 2, "timestamp",
 					   TIMESTAMPTZOID, -1, 0);
 	tupdesc = BlessTupleDesc(tupdesc);
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index 70d0e1c215..60d2aef83e 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -3360,7 +3360,7 @@ pg_get_multixact_members(PG_FUNCTION_ARGS)
 
 		tupdesc = CreateTemplateTupleDesc(2);
 		TupleDescInitEntry(tupdesc, (AttrNumber) 1, "xid",
-						   XIDOID, -1, 0);
+						   XID4OID, -1, 0);
 		TupleDescInitEntry(tupdesc, (AttrNumber) 2, "mode",
 						   TEXTOID, -1, 0);
 
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 2f7d4ed59a..d8c91ad66e 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -736,7 +736,7 @@ pg_prepared_xact(PG_FUNCTION_ARGS)
 		/* this had better match pg_prepared_xacts view in system_views.sql */
 		tupdesc = CreateTemplateTupleDesc(5);
 		TupleDescInitEntry(tupdesc, (AttrNumber) 1, "transaction",
-						   XIDOID, -1, 0);
+						   XID4OID, -1, 0);
 		TupleDescInitEntry(tupdesc, (AttrNumber) 2, "gid",
 						   TEXTOID, -1, 0);
 		TupleDescInitEntry(tupdesc, (AttrNumber) 3, "prepared",
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index 5480a024e0..08a8d642a0 100644
--- a/src/backend/bootstrap/bootstrap.c
+++ b/src/backend/bootstrap/bootstrap.c
@@ -131,8 +131,8 @@ static const struct typinfo TypInfo[] = {
 	F_OIDIN, F_OIDOUT},
 	{"tid", TIDOID, 0, 6, false, TYPALIGN_SHORT, TYPSTORAGE_PLAIN, InvalidOid,
 	F_TIDIN, F_TIDOUT},
-	{"xid", XIDOID, 0, 4, true, TYPALIGN_INT, TYPSTORAGE_PLAIN, InvalidOid,
-	F_XIDIN, F_XIDOUT},
+	{"xid4", XID4OID, 0, 4, true, TYPALIGN_INT, TYPSTORAGE_PLAIN, InvalidOid,
+	F_XID4IN, F_XID4OUT},
 	{"cid", CIDOID, 0, 4, true, TYPALIGN_INT, TYPSTORAGE_PLAIN, InvalidOid,
 	F_CIDIN, F_CIDOUT},
 	{"pg_node_tree", PGNODETREEOID, 0, -1, false, TYPALIGN_INT, TYPSTORAGE_EXTENDED, DEFAULT_COLLATION_OID,
diff --git a/src/backend/catalog/Catalog.pm b/src/backend/catalog/Catalog.pm
index dd39a086ce..b8926cea81 100644
--- a/src/backend/catalog/Catalog.pm
+++ b/src/backend/catalog/Catalog.pm
@@ -33,7 +33,7 @@ sub ParseHeader
 		'int64'         => 'int8',
 		'Oid'           => 'oid',
 		'NameData'      => 'name',
-		'TransactionId' => 'xid',
+		'TransactionId' => 'xid4',
 		'XLogRecPtr'    => 'pg_lsn');
 
 	my %catalog;
diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl
index 8e03af4ffc..640b070b09 100644
--- a/src/backend/catalog/genbki.pl
+++ b/src/backend/catalog/genbki.pl
@@ -742,9 +742,9 @@ sub gen_pg_attribute
 			$attnum = 0;
 			my @SYS_ATTRS = (
 				{ name => 'ctid',     type => 'tid' },
-				{ name => 'xmin',     type => 'xid' },
+				{ name => 'xmin',     type => 'xid4' },
 				{ name => 'cmin',     type => 'cid' },
-				{ name => 'xmax',     type => 'xid' },
+				{ name => 'xmax',     type => 'xid4' },
 				{ name => 'cmax',     type => 'cid' },
 				{ name => 'tableoid', type => 'oid' });
 			foreach my $attr (@SYS_ATTRS)
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index 632c058b80..a0b9577b94 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -164,7 +164,7 @@ static const FormData_pg_attribute a1 = {
 
 static const FormData_pg_attribute a2 = {
 	.attname = {"xmin"},
-	.atttypid = XIDOID,
+	.atttypid = XID4OID,
 	.attlen = sizeof(TransactionId),
 	.attnum = MinTransactionIdAttributeNumber,
 	.attcacheoff = -1,
@@ -192,7 +192,7 @@ static const FormData_pg_attribute a3 = {
 
 static const FormData_pg_attribute a4 = {
 	.attname = {"xmax"},
-	.atttypid = XIDOID,
+	.atttypid = XID4OID,
 	.attlen = sizeof(TransactionId),
 	.attnum = MaxTransactionIdAttributeNumber,
 	.attcacheoff = -1,
diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql
index d406ea8118..732a4362c1 100644
--- a/src/backend/catalog/system_views.sql
+++ b/src/backend/catalog/system_views.sql
@@ -1233,7 +1233,7 @@ CREATE OR REPLACE FUNCTION
 
 CREATE OR REPLACE FUNCTION pg_logical_slot_get_changes(
     IN slot_name name, IN upto_lsn pg_lsn, IN upto_nchanges int, VARIADIC options text[] DEFAULT '{}',
-    OUT lsn pg_lsn, OUT xid xid, OUT data text)
+    OUT lsn pg_lsn, OUT xid xid4, OUT data text)
 RETURNS SETOF RECORD
 LANGUAGE INTERNAL
 VOLATILE ROWS 1000 COST 1000
@@ -1241,7 +1241,7 @@ AS 'pg_logical_slot_get_changes';
 
 CREATE OR REPLACE FUNCTION pg_logical_slot_peek_changes(
     IN slot_name name, IN upto_lsn pg_lsn, IN upto_nchanges int, VARIADIC options text[] DEFAULT '{}',
-    OUT lsn pg_lsn, OUT xid xid, OUT data text)
+    OUT lsn pg_lsn, OUT xid xid4, OUT data text)
 RETURNS SETOF RECORD
 LANGUAGE INTERNAL
 VOLATILE ROWS 1000 COST 1000
@@ -1249,7 +1249,7 @@ AS 'pg_logical_slot_peek_changes';
 
 CREATE OR REPLACE FUNCTION pg_logical_slot_get_binary_changes(
     IN slot_name name, IN upto_lsn pg_lsn, IN upto_nchanges int, VARIADIC options text[] DEFAULT '{}',
-    OUT lsn pg_lsn, OUT xid xid, OUT data bytea)
+    OUT lsn pg_lsn, OUT xid xid4, OUT data bytea)
 RETURNS SETOF RECORD
 LANGUAGE INTERNAL
 VOLATILE ROWS 1000 COST 1000
@@ -1257,7 +1257,7 @@ AS 'pg_logical_slot_get_binary_changes';
 
 CREATE OR REPLACE FUNCTION pg_logical_slot_peek_binary_changes(
     IN slot_name name, IN upto_lsn pg_lsn, IN upto_nchanges int, VARIADIC options text[] DEFAULT '{}',
-    OUT lsn pg_lsn, OUT xid xid, OUT data bytea)
+    OUT lsn pg_lsn, OUT xid xid4, OUT data bytea)
 RETURNS SETOF RECORD
 LANGUAGE INTERNAL
 VOLATILE ROWS 1000 COST 1000
diff --git a/src/backend/utils/adt/lockfuncs.c b/src/backend/utils/adt/lockfuncs.c
index ecb1bf92ff..55942ee473 100644
--- a/src/backend/utils/adt/lockfuncs.c
+++ b/src/backend/utils/adt/lockfuncs.c
@@ -121,7 +121,7 @@ pg_lock_status(PG_FUNCTION_ARGS)
 		TupleDescInitEntry(tupdesc, (AttrNumber) 6, "virtualxid",
 						   TEXTOID, -1, 0);
 		TupleDescInitEntry(tupdesc, (AttrNumber) 7, "transactionid",
-						   XIDOID, -1, 0);
+						   XID4OID, -1, 0);
 		TupleDescInitEntry(tupdesc, (AttrNumber) 8, "classid",
 						   OIDOID, -1, 0);
 		TupleDescInitEntry(tupdesc, (AttrNumber) 9, "objid",
diff --git a/src/backend/utils/adt/xid.c b/src/backend/utils/adt/xid.c
index 20389aff1d..2cd5527772 100644
--- a/src/backend/utils/adt/xid.c
+++ b/src/backend/utils/adt/xid.c
@@ -31,7 +31,7 @@
 
 
 Datum
-xidin(PG_FUNCTION_ARGS)
+xid4in(PG_FUNCTION_ARGS)
 {
 	char	   *str = PG_GETARG_CSTRING(0);
 
@@ -39,7 +39,7 @@ xidin(PG_FUNCTION_ARGS)
 }
 
 Datum
-xidout(PG_FUNCTION_ARGS)
+xid4out(PG_FUNCTION_ARGS)
 {
 	TransactionId transactionId = PG_GETARG_TRANSACTIONID(0);
 	char	   *result = (char *) palloc(16);
@@ -49,10 +49,10 @@ xidout(PG_FUNCTION_ARGS)
 }
 
 /*
- *		xidrecv			- converts external binary format to xid
+ *		xid4recv		- converts external binary format to xid4
  */
 Datum
-xidrecv(PG_FUNCTION_ARGS)
+xid4recv(PG_FUNCTION_ARGS)
 {
 	StringInfo	buf = (StringInfo) PG_GETARG_POINTER(0);
 
@@ -60,10 +60,10 @@ xidrecv(PG_FUNCTION_ARGS)
 }
 
 /*
- *		xidsend			- converts xid to binary format
+ *		xid4send		- converts xid4 to binary format
  */
 Datum
-xidsend(PG_FUNCTION_ARGS)
+xid4send(PG_FUNCTION_ARGS)
 {
 	TransactionId arg1 = PG_GETARG_TRANSACTIONID(0);
 	StringInfoData buf;
@@ -74,10 +74,10 @@ xidsend(PG_FUNCTION_ARGS)
 }
 
 /*
- *		xideq			- are two xids equal?
+ *		xid4eq			- are two xid4s equal?
  */
 Datum
-xideq(PG_FUNCTION_ARGS)
+xid4eq(PG_FUNCTION_ARGS)
 {
 	TransactionId xid1 = PG_GETARG_TRANSACTIONID(0);
 	TransactionId xid2 = PG_GETARG_TRANSACTIONID(1);
@@ -86,10 +86,10 @@ xideq(PG_FUNCTION_ARGS)
 }
 
 /*
- *		xidneq			- are two xids different?
+ *		xid4ne			- are two xid4s different?
  */
 Datum
-xidneq(PG_FUNCTION_ARGS)
+xid4ne(PG_FUNCTION_ARGS)
 {
 	TransactionId xid1 = PG_GETARG_TRANSACTIONID(0);
 	TransactionId xid2 = PG_GETARG_TRANSACTIONID(1);
diff --git a/src/backend/utils/misc/pg_controldata.c b/src/backend/utils/misc/pg_controldata.c
index 419b58330f..66b1f8eb1a 100644
--- a/src/backend/utils/misc/pg_controldata.c
+++ b/src/backend/utils/misc/pg_controldata.c
@@ -110,23 +110,23 @@ pg_control_checkpoint(PG_FUNCTION_ARGS)
 	TupleDescInitEntry(tupdesc, (AttrNumber) 8, "next_oid",
 					   OIDOID, -1, 0);
 	TupleDescInitEntry(tupdesc, (AttrNumber) 9, "next_multixact_id",
-					   XIDOID, -1, 0);
+					   XID4OID, -1, 0);
 	TupleDescInitEntry(tupdesc, (AttrNumber) 10, "next_multi_offset",
-					   XIDOID, -1, 0);
+					   XID4OID, -1, 0);
 	TupleDescInitEntry(tupdesc, (AttrNumber) 11, "oldest_xid",
-					   XIDOID, -1, 0);
+					   XID4OID, -1, 0);
 	TupleDescInitEntry(tupdesc, (AttrNumber) 12, "oldest_xid_dbid",
 					   OIDOID, -1, 0);
 	TupleDescInitEntry(tupdesc, (AttrNumber) 13, "oldest_active_xid",
-					   XIDOID, -1, 0);
+					   XID4OID, -1, 0);
 	TupleDescInitEntry(tupdesc, (AttrNumber) 14, "oldest_multi_xid",
-					   XIDOID, -1, 0);
+					   XID4OID, -1, 0);
 	TupleDescInitEntry(tupdesc, (AttrNumber) 15, "oldest_multi_dbid",
 					   OIDOID, -1, 0);
 	TupleDescInitEntry(tupdesc, (AttrNumber) 16, "oldest_commit_ts_xid",
-					   XIDOID, -1, 0);
+					   XID4OID, -1, 0);
 	TupleDescInitEntry(tupdesc, (AttrNumber) 17, "newest_commit_ts_xid",
-					   XIDOID, -1, 0);
+					   XID4OID, -1, 0);
 	TupleDescInitEntry(tupdesc, (AttrNumber) 18, "checkpoint_time",
 					   TIMESTAMPTZOID, -1, 0);
 	tupdesc = BlessTupleDesc(tupdesc);
diff --git a/src/fe_utils/print.c b/src/fe_utils/print.c
index 66a50f183f..2134f9b84c 100644
--- a/src/fe_utils/print.c
+++ b/src/fe_utils/print.c
@@ -3508,7 +3508,7 @@ column_type_alignment(Oid ftype)
 		case FLOAT8OID:
 		case NUMERICOID:
 		case OIDOID:
-		case XIDOID:
+		case XID4OID:
 		case XID8OID:
 		case CIDOID:
 		case CASHOID:
diff --git a/src/include/catalog/pg_amop.dat b/src/include/catalog/pg_amop.dat
index b5dfaad9ec..3f60752501 100644
--- a/src/include/catalog/pg_amop.dat
+++ b/src/include/catalog/pg_amop.dat
@@ -1023,9 +1023,9 @@
   amoprighttype => 'bytea', amopstrategy => '1', amopopr => '=(bytea,bytea)',
   amopmethod => 'hash' },
 
-# xid_ops
-{ amopfamily => 'hash/xid_ops', amoplefttype => 'xid', amoprighttype => 'xid',
-  amopstrategy => '1', amopopr => '=(xid,xid)', amopmethod => 'hash' },
+# xid4_ops
+{ amopfamily => 'hash/xid4_ops', amoplefttype => 'xid4', amoprighttype => 'xid4',
+  amopstrategy => '1', amopopr => '=(xid4,xid4)', amopmethod => 'hash' },
 
 # xid8_ops
 { amopfamily => 'hash/xid8_ops', amoplefttype => 'xid8', amoprighttype => 'xid8',
diff --git a/src/include/catalog/pg_amproc.dat b/src/include/catalog/pg_amproc.dat
index 37b580883f..922d8d46f4 100644
--- a/src/include/catalog/pg_amproc.dat
+++ b/src/include/catalog/pg_amproc.dat
@@ -399,10 +399,10 @@
 { amprocfamily => 'hash/bytea_ops', amproclefttype => 'bytea',
   amprocrighttype => 'bytea', amprocnum => '2',
   amproc => 'hashvarlenaextended' },
-{ amprocfamily => 'hash/xid_ops', amproclefttype => 'xid',
-  amprocrighttype => 'xid', amprocnum => '1', amproc => 'hashint4' },
-{ amprocfamily => 'hash/xid_ops', amproclefttype => 'xid',
-  amprocrighttype => 'xid', amprocnum => '2', amproc => 'hashint4extended' },
+{ amprocfamily => 'hash/xid4_ops', amproclefttype => 'xid4',
+  amprocrighttype => 'xid4', amprocnum => '1', amproc => 'hashint4' },
+{ amprocfamily => 'hash/xid4_ops', amproclefttype => 'xid4',
+  amprocrighttype => 'xid4', amprocnum => '2', amproc => 'hashint4extended' },
 { amprocfamily => 'hash/xid8_ops', amproclefttype => 'xid8',
   amprocrighttype => 'xid8', amprocnum => '1', amproc => 'hashint8' },
 { amprocfamily => 'hash/xid8_ops', amproclefttype => 'xid8',
diff --git a/src/include/catalog/pg_cast.dat b/src/include/catalog/pg_cast.dat
index 5a58f50fbb..ec698b12f3 100644
--- a/src/include/catalog/pg_cast.dat
+++ b/src/include/catalog/pg_cast.dat
@@ -93,8 +93,8 @@
 { castsource => 'bool', casttarget => 'int4', castfunc => 'int4(bool)',
   castcontext => 'e', castmethod => 'f' },
 
-# Allow explicit coercions between xid8 and xid
-{ castsource => 'xid8', casttarget => 'xid', castfunc => 'xid(xid8)',
+# Allow explicit coercions between xid8 and xid4
+{ castsource => 'xid8', casttarget => 'xid4', castfunc => 'xid4(xid8)',
   castcontext => 'e', castmethod => 'f' },
 
 # OID category: allow implicit conversion from any integral type (including
diff --git a/src/include/catalog/pg_opclass.dat b/src/include/catalog/pg_opclass.dat
index f2342bb328..860d0ed020 100644
--- a/src/include/catalog/pg_opclass.dat
+++ b/src/include/catalog/pg_opclass.dat
@@ -166,8 +166,8 @@
   opcintype => 'bytea' },
 { opcmethod => 'btree', opcname => 'tid_ops', opcfamily => 'btree/tid_ops',
   opcintype => 'tid' },
-{ opcmethod => 'hash', opcname => 'xid_ops', opcfamily => 'hash/xid_ops',
-  opcintype => 'xid' },
+{ opcmethod => 'hash', opcname => 'xid4_ops', opcfamily => 'hash/xid4_ops',
+  opcintype => 'xid4' },
 { opcmethod => 'hash', opcname => 'xid8_ops', opcfamily => 'hash/xid8_ops',
   opcintype => 'xid8' },
 { opcmethod => 'btree', opcname => 'xid8_ops', opcfamily => 'btree/xid8_ops',
diff --git a/src/include/catalog/pg_operator.dat b/src/include/catalog/pg_operator.dat
index 00ada7e48f..22467f5d42 100644
--- a/src/include/catalog/pg_operator.dat
+++ b/src/include/catalog/pg_operator.dat
@@ -178,20 +178,20 @@
   oprresult => 'anyarray', oprcode => 'array_cat' },
 
 { oid => '352', descr => 'equal',
-  oprname => '=', oprcanhash => 't', oprleft => 'xid', oprright => 'xid',
-  oprresult => 'bool', oprcom => '=(xid,xid)', oprnegate => '<>(xid,xid)',
-  oprcode => 'xideq', oprrest => 'eqsel', oprjoin => 'eqjoinsel' },
+  oprname => '=', oprcanhash => 't', oprleft => 'xid4', oprright => 'xid4',
+  oprresult => 'bool', oprcom => '=(xid4,xid4)', oprnegate => '<>(xid4,xid4)',
+  oprcode => 'xid4eq', oprrest => 'eqsel', oprjoin => 'eqjoinsel' },
 { oid => '353', descr => 'equal',
-  oprname => '=', oprleft => 'xid', oprright => 'int4', oprresult => 'bool',
-  oprnegate => '<>(xid,int4)', oprcode => 'xideqint4', oprrest => 'eqsel',
+  oprname => '=', oprleft => 'xid4', oprright => 'int4', oprresult => 'bool',
+  oprnegate => '<>(xid4,int4)', oprcode => 'xid4eqint4', oprrest => 'eqsel',
   oprjoin => 'eqjoinsel' },
 { oid => '3315', descr => 'not equal',
-  oprname => '<>', oprleft => 'xid', oprright => 'xid', oprresult => 'bool',
-  oprcom => '<>(xid,xid)', oprnegate => '=(xid,xid)', oprcode => 'xidneq',
+  oprname => '<>', oprleft => 'xid4', oprright => 'xid4', oprresult => 'bool',
+  oprcom => '<>(xid4,xid4)', oprnegate => '=(xid4,xid4)', oprcode => 'xid4ne',
   oprrest => 'neqsel', oprjoin => 'neqjoinsel' },
 { oid => '3316', descr => 'not equal',
-  oprname => '<>', oprleft => 'xid', oprright => 'int4', oprresult => 'bool',
-  oprnegate => '=(xid,int4)', oprcode => 'xidneqint4', oprrest => 'neqsel',
+  oprname => '<>', oprleft => 'xid4', oprright => 'int4', oprresult => 'bool',
+  oprnegate => '=(xid4,int4)', oprcode => 'xid4neint4', oprrest => 'neqsel',
   oprjoin => 'neqjoinsel' },
 { oid => '9418', descr => 'equal',
   oprname => '=', oprcanmerge => 't', oprcanhash => 't', oprleft => 'xid8',
diff --git a/src/include/catalog/pg_opfamily.dat b/src/include/catalog/pg_opfamily.dat
index 4004138d77..adc63eb61a 100644
--- a/src/include/catalog/pg_opfamily.dat
+++ b/src/include/catalog/pg_opfamily.dat
@@ -109,7 +109,7 @@
 { oid => '2789',
   opfmethod => 'btree', opfname => 'tid_ops' },
 { oid => '2225',
-  opfmethod => 'hash', opfname => 'xid_ops' },
+  opfmethod => 'hash', opfname => 'xid4_ops' },
 { oid => '8164',
   opfmethod => 'hash', opfname => 'xid8_ops' },
 { oid => '9322',
diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat
index 4bce3ad8de..54ec931035 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -107,11 +107,11 @@
   proname => 'tidout', prorettype => 'cstring', proargtypes => 'tid',
   prosrc => 'tidout' },
 { oid => '50', descr => 'I/O',
-  proname => 'xidin', prorettype => 'xid', proargtypes => 'cstring',
-  prosrc => 'xidin' },
+  proname => 'xid4in', prorettype => 'xid4', proargtypes => 'cstring',
+  prosrc => 'xid4in' },
 { oid => '51', descr => 'I/O',
-  proname => 'xidout', prorettype => 'cstring', proargtypes => 'xid',
-  prosrc => 'xidout' },
+  proname => 'xid4out', prorettype => 'cstring', proargtypes => 'xid4',
+  prosrc => 'xid4out' },
 { oid => '9420', descr => 'I/O',
   proname => 'xid8in', prorettype => 'xid8', proargtypes => 'cstring',
   prosrc => 'xid8in' },
@@ -170,11 +170,11 @@
   proname => 'starts_with', proleakproof => 't', prorettype => 'bool',
   proargtypes => 'text text', prosrc => 'text_starts_with' },
 { oid => '68',
-  proname => 'xideq', proleakproof => 't', prorettype => 'bool',
-  proargtypes => 'xid xid', prosrc => 'xideq' },
+  proname => 'xid4eq', proleakproof => 't', prorettype => 'bool',
+  proargtypes => 'xid4 xid4', prosrc => 'xid4eq' },
 { oid => '3308',
-  proname => 'xidneq', proleakproof => 't', prorettype => 'bool',
-  proargtypes => 'xid xid', prosrc => 'xidneq' },
+  proname => 'xid4ne', proleakproof => 't', prorettype => 'bool',
+  proargtypes => 'xid4 xid4', prosrc => 'xid4ne' },
 { oid => '9557',
   proname => 'xid8eq', proleakproof => 't', prorettype => 'bool',
   proargtypes => 'xid8 xid8', prosrc => 'xid8eq' },
@@ -196,8 +196,8 @@
 { oid => '9912', descr => 'less-equal-greater',
   proname => 'xid8cmp', proleakproof => 't', prorettype => 'int4',
   proargtypes => 'xid8 xid8', prosrc => 'xid8cmp' },
-{ oid => '9421', descr => 'convert xid8 to xid',
-  proname => 'xid', prorettype => 'xid', proargtypes => 'xid8',
+{ oid => '9421', descr => 'convert xid8 to xid4',
+  proname => 'xid4', prorettype => 'xid4', proargtypes => 'xid8',
   prosrc => 'xid8toxid' },
 { oid => '69',
   proname => 'cideq', proleakproof => 't', prorettype => 'bool',
@@ -2343,11 +2343,11 @@
 { oid => '1181',
   descr => 'age of a transaction ID, in transactions before current transaction',
   proname => 'age', provolatile => 's', proparallel => 'r',
-  prorettype => 'int4', proargtypes => 'xid', prosrc => 'xid_age' },
+  prorettype => 'int4', proargtypes => 'xid4', prosrc => 'xid_age' },
 { oid => '3939',
   descr => 'age of a multi-transaction ID, in multi-transactions before current multi-transaction',
   proname => 'mxid_age', provolatile => 's', prorettype => 'int4',
-  proargtypes => 'xid', prosrc => 'mxid_age' },
+  proargtypes => 'xid4', prosrc => 'mxid_age' },
 
 { oid => '1188',
   proname => 'timestamptz_mi', prorettype => 'interval',
@@ -2681,11 +2681,11 @@
   prosrc => 'bpcharlen' },
 
 { oid => '1319',
-  proname => 'xideqint4', proleakproof => 't', prorettype => 'bool',
-  proargtypes => 'xid int4', prosrc => 'xideq' },
+  proname => 'xid4eqint4', proleakproof => 't', prorettype => 'bool',
+  proargtypes => 'xid4 int4', prosrc => 'xid4eq' },
 { oid => '3309',
-  proname => 'xidneqint4', proleakproof => 't', prorettype => 'bool',
-  proargtypes => 'xid int4', prosrc => 'xidneq' },
+  proname => 'xid4neint4', proleakproof => 't', prorettype => 'bool',
+  proargtypes => 'xid4 int4', prosrc => 'xid4ne' },
 
 { oid => '1326',
   proname => 'interval_div', prorettype => 'interval',
@@ -5219,7 +5219,7 @@
   proname => 'pg_stat_get_activity', prorows => '100', proisstrict => 'f',
   proretset => 't', provolatile => 's', proparallel => 'r',
   prorettype => 'record', proargtypes => 'int4',
-  proallargtypes => '{int4,oid,int4,oid,text,text,text,text,text,timestamptz,timestamptz,timestamptz,timestamptz,inet,text,int4,xid,xid,text,bool,text,text,int4,bool,text,numeric,text,bool,text,bool,int4}',
+  proallargtypes => '{int4,oid,int4,oid,text,text,text,text,text,timestamptz,timestamptz,timestamptz,timestamptz,inet,text,int4,xid4,xid4,text,bool,text,text,int4,bool,text,numeric,text,bool,text,bool,int4}',
   proargmodes => '{i,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}',
   proargnames => '{pid,datid,pid,usesysid,application_name,state,query,wait_event_type,wait_event,xact_start,query_start,backend_start,state_change,client_addr,client_hostname,client_port,backend_xid,backend_xmin,backend_type,ssl,sslversion,sslcipher,sslbits,sslcompression,ssl_client_dn,ssl_client_serial,ssl_issuer_dn,gss_auth,gss_princ,gss_enc,leader_pid}',
   prosrc => 'pg_stat_get_activity' },
@@ -5910,7 +5910,7 @@
 { oid => '1371', descr => 'view system lock information',
   proname => 'pg_lock_status', prorows => '1000', proretset => 't',
   provolatile => 'v', prorettype => 'record', proargtypes => '',
-  proallargtypes => '{text,oid,oid,int4,int2,text,xid,oid,oid,int2,text,int4,text,bool,bool}',
+  proallargtypes => '{text,oid,oid,int4,int2,text,xid4,oid,oid,int2,text,int4,text,bool,bool}',
   proargmodes => '{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}',
   proargnames => '{locktype,database,relation,page,tuple,virtualxid,transactionid,classid,objid,objsubid,virtualtransaction,pid,mode,granted,fastpath}',
   prosrc => 'pg_lock_status' },
@@ -5930,26 +5930,26 @@
 { oid => '1065', descr => 'view two-phase transactions',
   proname => 'pg_prepared_xact', prorows => '1000', proretset => 't',
   provolatile => 'v', prorettype => 'record', proargtypes => '',
-  proallargtypes => '{xid,text,timestamptz,oid,oid}',
+  proallargtypes => '{xid4,text,timestamptz,oid,oid}',
   proargmodes => '{o,o,o,o,o}',
   proargnames => '{transaction,gid,prepared,ownerid,dbid}',
   prosrc => 'pg_prepared_xact' },
 { oid => '3819', descr => 'view members of a multixactid',
   proname => 'pg_get_multixact_members', prorows => '1000', proretset => 't',
-  provolatile => 'v', prorettype => 'record', proargtypes => 'xid',
-  proallargtypes => '{xid,xid,text}', proargmodes => '{i,o,o}',
+  provolatile => 'v', prorettype => 'record', proargtypes => 'xid4',
+  proallargtypes => '{xid4,xid4,text}', proargmodes => '{i,o,o}',
   proargnames => '{multixid,xid,mode}', prosrc => 'pg_get_multixact_members' },
 
 { oid => '3581', descr => 'get commit timestamp of a transaction',
   proname => 'pg_xact_commit_timestamp', provolatile => 'v',
-  prorettype => 'timestamptz', proargtypes => 'xid',
+  prorettype => 'timestamptz', proargtypes => 'xid4',
   prosrc => 'pg_xact_commit_timestamp' },
 
 { oid => '3583',
   descr => 'get transaction Id and commit timestamp of latest transaction commit',
   proname => 'pg_last_committed_xact', provolatile => 'v',
   prorettype => 'record', proargtypes => '',
-  proallargtypes => '{xid,timestamptz}', proargmodes => '{o,o}',
+  proallargtypes => '{xid4,timestamptz}', proargmodes => '{o,o}',
   proargnames => '{xid,timestamp}', prosrc => 'pg_last_committed_xact' },
 
 { oid => '3537', descr => 'get identification of SQL object',
@@ -7507,11 +7507,11 @@
   proname => 'tidsend', prorettype => 'bytea', proargtypes => 'tid',
   prosrc => 'tidsend' },
 { oid => '2440', descr => 'I/O',
-  proname => 'xidrecv', prorettype => 'xid', proargtypes => 'internal',
-  prosrc => 'xidrecv' },
+  proname => 'xid4recv', prorettype => 'xid4', proargtypes => 'internal',
+  prosrc => 'xid4recv' },
 { oid => '2441', descr => 'I/O',
-  proname => 'xidsend', prorettype => 'bytea', proargtypes => 'xid',
-  prosrc => 'xidsend' },
+  proname => 'xid4send', prorettype => 'bytea', proargtypes => 'xid4',
+  prosrc => 'xid4send' },
 { oid => '2442', descr => 'I/O',
   proname => 'cidrecv', prorettype => 'cid', proargtypes => 'internal',
   prosrc => 'cidrecv' },
@@ -10065,7 +10065,7 @@
   proname => 'pg_get_replication_slots', prorows => '10', proisstrict => 'f',
   proretset => 't', provolatile => 's', prorettype => 'record',
   proargtypes => '',
-  proallargtypes => '{name,name,text,oid,bool,bool,int4,xid,xid,pg_lsn,pg_lsn,text,pg_lsn}',
+  proallargtypes => '{name,name,text,oid,bool,bool,int4,xid4,xid4,pg_lsn,pg_lsn,text,pg_lsn}',
   proargmodes => '{o,o,o,o,o,o,o,o,o,o,o,o,o}',
   proargnames => '{slot_name,plugin,slot_type,datoid,temporary,active,active_pid,xmin,catalog_xmin,restart_lsn,confirmed_flush_lsn,wal_status,min_safe_lsn}',
   prosrc => 'pg_get_replication_slots' },
@@ -10104,7 +10104,7 @@
   prorows => '1000', provariadic => 'text', proisstrict => 'f',
   proretset => 't', provolatile => 'v', proparallel => 'u',
   prorettype => 'record', proargtypes => 'name pg_lsn int4 _text',
-  proallargtypes => '{name,pg_lsn,int4,_text,pg_lsn,xid,text}',
+  proallargtypes => '{name,pg_lsn,int4,_text,pg_lsn,xid4,text}',
   proargmodes => '{i,i,i,v,o,o,o}',
   proargnames => '{slot_name,upto_lsn,upto_nchanges,options,lsn,xid,data}',
   prosrc => 'pg_logical_slot_get_changes' },
@@ -10113,7 +10113,7 @@
   prorows => '1000', provariadic => 'text', proisstrict => 'f',
   proretset => 't', provolatile => 'v', proparallel => 'u',
   prorettype => 'record', proargtypes => 'name pg_lsn int4 _text',
-  proallargtypes => '{name,pg_lsn,int4,_text,pg_lsn,xid,bytea}',
+  proallargtypes => '{name,pg_lsn,int4,_text,pg_lsn,xid4,bytea}',
   proargmodes => '{i,i,i,v,o,o,o}',
   proargnames => '{slot_name,upto_lsn,upto_nchanges,options,lsn,xid,data}',
   prosrc => 'pg_logical_slot_get_binary_changes' },
@@ -10122,7 +10122,7 @@
   prorows => '1000', provariadic => 'text', proisstrict => 'f',
   proretset => 't', provolatile => 'v', proparallel => 'u',
   prorettype => 'record', proargtypes => 'name pg_lsn int4 _text',
-  proallargtypes => '{name,pg_lsn,int4,_text,pg_lsn,xid,text}',
+  proallargtypes => '{name,pg_lsn,int4,_text,pg_lsn,xid4,text}',
   proargmodes => '{i,i,i,v,o,o,o}',
   proargnames => '{slot_name,upto_lsn,upto_nchanges,options,lsn,xid,data}',
   prosrc => 'pg_logical_slot_peek_changes' },
@@ -10131,7 +10131,7 @@
   prorows => '1000', provariadic => 'text', proisstrict => 'f',
   proretset => 't', provolatile => 'v', proparallel => 'u',
   prorettype => 'record', proargtypes => 'name pg_lsn int4 _text',
-  proallargtypes => '{name,pg_lsn,int4,_text,pg_lsn,xid,bytea}',
+  proallargtypes => '{name,pg_lsn,int4,_text,pg_lsn,xid4,bytea}',
   proargmodes => '{i,i,i,v,o,o,o}',
   proargnames => '{slot_name,upto_lsn,upto_nchanges,options,lsn,xid,data}',
   prosrc => 'pg_logical_slot_peek_binary_changes' },
@@ -10842,7 +10842,7 @@
   descr => 'pg_controldata checkpoint state information as a function',
   proname => 'pg_control_checkpoint', provolatile => 'v',
   prorettype => 'record', proargtypes => '',
-  proallargtypes => '{pg_lsn,pg_lsn,text,int4,int4,bool,text,oid,xid,xid,xid,oid,xid,xid,oid,xid,xid,timestamptz}',
+  proallargtypes => '{pg_lsn,pg_lsn,text,int4,int4,bool,text,oid,xid4,xid4,xid4,oid,xid4,xid4,oid,xid4,xid4,timestamptz}',
   proargmodes => '{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}',
   proargnames => '{checkpoint_lsn,redo_lsn,redo_wal_file,timeline_id,prev_timeline_id,full_page_writes,next_xid,next_oid,next_multixact_id,next_multi_offset,oldest_xid,oldest_xid_dbid,oldest_active_xid,oldest_multi_xid,oldest_multi_dbid,oldest_commit_ts_xid,newest_commit_ts_xid,checkpoint_time}',
   prosrc => 'pg_control_checkpoint' },
diff --git a/src/include/catalog/pg_type.dat b/src/include/catalog/pg_type.dat
index 78f44af5e7..912d41d5c9 100644
--- a/src/include/catalog/pg_type.dat
+++ b/src/include/catalog/pg_type.dat
@@ -97,9 +97,9 @@
   typinput => 'tidin', typoutput => 'tidout', typreceive => 'tidrecv',
   typsend => 'tidsend', typalign => 's' },
 { oid => '28', array_type_oid => '1011', descr => 'transaction id',
-  typname => 'xid', typlen => '4', typbyval => 't', typcategory => 'U',
-  typinput => 'xidin', typoutput => 'xidout', typreceive => 'xidrecv',
-  typsend => 'xidsend', typalign => 'i' },
+  typname => 'xid4', typlen => '4', typbyval => 't', typcategory => 'U',
+  typinput => 'xid4in', typoutput => 'xid4out', typreceive => 'xid4recv',
+  typsend => 'xid4send', typalign => 'i' },
 { oid => '29', array_type_oid => '1012',
   descr => 'command identifier type, sequence in transaction id',
   typname => 'cid', typlen => '4', typbyval => 't', typcategory => 'U',
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index 59e8e3a825..230fec9c41 100644
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
@@ -204,7 +204,7 @@ ecpg_is_type_an_array(int type, const struct statement *stmt, const struct varia
 			return ECPG_ARRAY_ERROR;
 		if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TIDOID, ECPG_ARRAY_NONE, stmt->lineno))
 			return ECPG_ARRAY_ERROR;
-		if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), XIDOID, ECPG_ARRAY_NONE, stmt->lineno))
+		if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), XID4OID, ECPG_ARRAY_NONE, stmt->lineno))
 			return ECPG_ARRAY_ERROR;
 		if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), CIDOID, ECPG_ARRAY_NONE, stmt->lineno))
 			return ECPG_ARRAY_ERROR;
diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out
index f343f9b42e..83d09e4205 100644
--- a/src/test/regress/expected/alter_table.out
+++ b/src/test/regress/expected/alter_table.out
@@ -26,7 +26,7 @@ ALTER TABLE attmp ADD COLUMN g polygon;
 ALTER TABLE attmp ADD COLUMN i char;
 ALTER TABLE attmp ADD COLUMN k int4;
 ALTER TABLE attmp ADD COLUMN l tid;
-ALTER TABLE attmp ADD COLUMN m xid;
+ALTER TABLE attmp ADD COLUMN m xid4;
 ALTER TABLE attmp ADD COLUMN n oidvector;
 --ALTER TABLE attmp ADD COLUMN o lock;
 ALTER TABLE attmp ADD COLUMN p boolean;
@@ -68,7 +68,7 @@ ALTER TABLE attmp ADD COLUMN g polygon;
 ALTER TABLE attmp ADD COLUMN i char;
 ALTER TABLE attmp ADD COLUMN k int4;
 ALTER TABLE attmp ADD COLUMN l tid;
-ALTER TABLE attmp ADD COLUMN m xid;
+ALTER TABLE attmp ADD COLUMN m xid4;
 ALTER TABLE attmp ADD COLUMN n oidvector;
 --ALTER TABLE attmp ADD COLUMN o lock;
 ALTER TABLE attmp ADD COLUMN p boolean;
@@ -2556,7 +2556,7 @@ from pg_locks l join pg_class c on l.relation = c.oid
 where virtualtransaction = (
         select virtualtransaction
         from pg_locks
-        where transactionid = pg_current_xact_id()::xid)
+        where transactionid = pg_current_xact_id()::xid4)
 and locktype = 'relation'
 and relnamespace != (select oid from pg_namespace where nspname = 'pg_catalog')
 and c.relname != 'my_locks'
@@ -2719,7 +2719,7 @@ from pg_locks l join pg_class c on l.relation = c.oid
 where virtualtransaction = (
         select virtualtransaction
         from pg_locks
-        where transactionid = pg_current_xact_id()::xid)
+        where transactionid = pg_current_xact_id()::xid4)
 and locktype = 'relation'
 and relnamespace != (select oid from pg_namespace where nspname = 'pg_catalog')
 and c.relname = 'my_locks'
diff --git a/src/test/regress/expected/groupingsets.out b/src/test/regress/expected/groupingsets.out
index 05ff204f02..4301ba5d79 100644
--- a/src/test/regress/expected/groupingsets.out
+++ b/src/test/regress/expected/groupingsets.out
@@ -14,7 +14,7 @@ create temp table gstest3 (a integer, b integer, c integer, d integer);
 copy gstest3 from stdin;
 alter table gstest3 add primary key (a);
 create temp table gstest4(id integer, v integer,
-                          unhashable_col bit(4), unsortable_col xid);
+                          unhashable_col bit(4), unsortable_col xid4);
 insert into gstest4
 values (1,1,b'0000','1'), (2,2,b'0001','1'),
        (3,4,b'0010','2'), (4,8,b'0011','2'),
diff --git a/src/test/regress/expected/opr_sanity.out b/src/test/regress/expected/opr_sanity.out
index 8d350ab61b..74b3abf66c 100644
--- a/src/test/regress/expected/opr_sanity.out
+++ b/src/test/regress/expected/opr_sanity.out
@@ -542,7 +542,7 @@ int2lt(smallint,smallint)
 int4eq(integer,integer)
 int4lt(integer,integer)
 texteq(text,text)
-xideq(xid,xid)
+xid4eq(xid4,xid4)
 cideq(cid,cid)
 charne("char","char")
 charle("char","char")
@@ -719,7 +719,7 @@ tidne(tid,tid)
 tideq(tid,tid)
 timestamptz_cmp(timestamp with time zone,timestamp with time zone)
 interval_cmp(interval,interval)
-xideqint4(xid,integer)
+xid4eqint4(xid4,integer)
 timetz_eq(time with time zone,time with time zone)
 timetz_ne(time with time zone,time with time zone)
 timetz_lt(time with time zone,time with time zone)
@@ -822,8 +822,8 @@ pg_lsn_ge(pg_lsn,pg_lsn)
 pg_lsn_gt(pg_lsn,pg_lsn)
 pg_lsn_ne(pg_lsn,pg_lsn)
 pg_lsn_cmp(pg_lsn,pg_lsn)
-xidneq(xid,xid)
-xidneqint4(xid,integer)
+xid4ne(xid4,xid4)
+xid4neint4(xid4,integer)
 sha224(bytea)
 sha256(bytea)
 sha384(bytea)
diff --git a/src/test/regress/expected/update.out b/src/test/regress/expected/update.out
index bf939d79f6..3a76444dea 100644
--- a/src/test/regress/expected/update.out
+++ b/src/test/regress/expected/update.out
@@ -232,7 +232,7 @@ INSERT INTO upsert_test VALUES (1, 'Bat') ON CONFLICT(a)
 -- https://www.postgresql.org/message-id/73436355-6432-49B1-92ED-1FE4F7E7E100%40finefun.com.au
 INSERT INTO upsert_test VALUES (2, 'Beeble') ON CONFLICT(a)
   DO UPDATE SET (b, a) = (SELECT b || ', Excluded', a from upsert_test i WHERE i.a = excluded.a)
-  RETURNING tableoid::regclass, xmin = pg_current_xact_id()::xid AS xmin_correct, xmax = 0 AS xmax_correct;
+  RETURNING tableoid::regclass, xmin = pg_current_xact_id()::xid4 AS xmin_correct, xmax = 0 AS xmax_correct;
   tableoid   | xmin_correct | xmax_correct 
 -------------+--------------+--------------
  upsert_test | t            | t
@@ -242,7 +242,7 @@ INSERT INTO upsert_test VALUES (2, 'Beeble') ON CONFLICT(a)
 -- but it seems worthwhile to have to be explicit if that changes.
 INSERT INTO upsert_test VALUES (2, 'Brox') ON CONFLICT(a)
   DO UPDATE SET (b, a) = (SELECT b || ', Excluded', a from upsert_test i WHERE i.a = excluded.a)
-  RETURNING tableoid::regclass, xmin = pg_current_xact_id()::xid AS xmin_correct, xmax = pg_current_xact_id()::xid AS xmax_correct;
+  RETURNING tableoid::regclass, xmin = pg_current_xact_id()::xid4 AS xmin_correct, xmax = pg_current_xact_id()::xid4 AS xmax_correct;
   tableoid   | xmin_correct | xmax_correct 
 -------------+--------------+--------------
  upsert_test | t            | t
diff --git a/src/test/regress/expected/xid.out b/src/test/regress/expected/xid.out
index b7a1ed0f9e..549ad4664a 100644
--- a/src/test/regress/expected/xid.out
+++ b/src/test/regress/expected/xid.out
@@ -1,29 +1,29 @@
--- xid and xid8
+-- xid4 and xid8
 -- values in range, in octal, decimal, hex
-select '010'::xid,
-       '42'::xid,
-       '0xffffffff'::xid,
-       '-1'::xid,
+select '010'::xid4,
+       '42'::xid4,
+       '0xffffffff'::xid4,
+       '-1'::xid4,
 	   '010'::xid8,
 	   '42'::xid8,
 	   '0xffffffffffffffff'::xid8,
 	   '-1'::xid8;
- xid | xid |    xid     |    xid     | xid8 | xid8 |         xid8         |         xid8         
------+-----+------------+------------+------+------+----------------------+----------------------
-   8 |  42 | 4294967295 | 4294967295 |    8 |   42 | 18446744073709551615 | 18446744073709551615
+ xid4 | xid4 |    xid4    |    xid4    | xid8 | xid8 |         xid8         |         xid8         
+------+------+------------+------------+------+------+----------------------+----------------------
+    8 |   42 | 4294967295 | 4294967295 |    8 |   42 | 18446744073709551615 | 18446744073709551615
 (1 row)
 
 -- garbage values are not yet rejected (perhaps they should be)
-select ''::xid;
- xid 
------
-   0
+select ''::xid4;
+ xid4 
+------
+    0
 (1 row)
 
-select 'asdf'::xid;
- xid 
------
-   0
+select 'asdf'::xid4;
+ xid4 
+------
+    0
 (1 row)
 
 select ''::xid8;
@@ -39,13 +39,13 @@ select 'asdf'::xid8;
 (1 row)
 
 -- equality
-select '1'::xid = '1'::xid;
+select '1'::xid4 = '1'::xid4;
  ?column? 
 ----------
  t
 (1 row)
 
-select '1'::xid != '1'::xid;
+select '1'::xid4 != '1'::xid4;
  ?column? 
 ----------
  f
@@ -64,38 +64,38 @@ select '1'::xid8 != '1'::xid8;
 (1 row)
 
 -- conversion
-select '1'::xid = '1'::xid8::xid;
+select '1'::xid4 = '1'::xid8::xid4;
  ?column? 
 ----------
  t
 (1 row)
 
-select '1'::xid != '1'::xid8::xid;
+select '1'::xid4 != '1'::xid8::xid4;
  ?column? 
 ----------
  f
 (1 row)
 
--- we don't want relational operators for xid, due to use of modular arithmetic
-select '1'::xid < '2'::xid;
-ERROR:  operator does not exist: xid < xid
-LINE 1: select '1'::xid < '2'::xid;
-                        ^
+-- we don't want relational operators for xid4, due to use of modular arithmetic
+select '1'::xid4 < '2'::xid4;
+ERROR:  operator does not exist: xid4 < xid4
+LINE 1: select '1'::xid4 < '2'::xid4;
+                         ^
 HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
-select '1'::xid <= '2'::xid;
-ERROR:  operator does not exist: xid <= xid
-LINE 1: select '1'::xid <= '2'::xid;
-                        ^
+select '1'::xid4 <= '2'::xid4;
+ERROR:  operator does not exist: xid4 <= xid4
+LINE 1: select '1'::xid4 <= '2'::xid4;
+                         ^
 HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
-select '1'::xid > '2'::xid;
-ERROR:  operator does not exist: xid > xid
-LINE 1: select '1'::xid > '2'::xid;
-                        ^
+select '1'::xid4 > '2'::xid4;
+ERROR:  operator does not exist: xid4 > xid4
+LINE 1: select '1'::xid4 > '2'::xid4;
+                         ^
 HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
-select '1'::xid >= '2'::xid;
-ERROR:  operator does not exist: xid >= xid
-LINE 1: select '1'::xid >= '2'::xid;
-                        ^
+select '1'::xid4 >= '2'::xid4;
+ERROR:  operator does not exist: xid4 >= xid4
+LINE 1: select '1'::xid4 >= '2'::xid4;
+                         ^
 HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
 -- we want them for xid8 though
 select '1'::xid8 < '2'::xid8, '2'::xid8 < '2'::xid8, '2'::xid8 < '1'::xid8;
diff --git a/src/test/regress/sql/alter_table.sql b/src/test/regress/sql/alter_table.sql
index fb5c9139d1..50c65160cb 100644
--- a/src/test/regress/sql/alter_table.sql
+++ b/src/test/regress/sql/alter_table.sql
@@ -41,7 +41,7 @@ ALTER TABLE attmp ADD COLUMN k int4;
 
 ALTER TABLE attmp ADD COLUMN l tid;
 
-ALTER TABLE attmp ADD COLUMN m xid;
+ALTER TABLE attmp ADD COLUMN m xid4;
 
 ALTER TABLE attmp ADD COLUMN n oidvector;
 
@@ -104,7 +104,7 @@ ALTER TABLE attmp ADD COLUMN k int4;
 
 ALTER TABLE attmp ADD COLUMN l tid;
 
-ALTER TABLE attmp ADD COLUMN m xid;
+ALTER TABLE attmp ADD COLUMN m xid4;
 
 ALTER TABLE attmp ADD COLUMN n oidvector;
 
@@ -1645,7 +1645,7 @@ from pg_locks l join pg_class c on l.relation = c.oid
 where virtualtransaction = (
         select virtualtransaction
         from pg_locks
-        where transactionid = pg_current_xact_id()::xid)
+        where transactionid = pg_current_xact_id()::xid4)
 and locktype = 'relation'
 and relnamespace != (select oid from pg_namespace where nspname = 'pg_catalog')
 and c.relname != 'my_locks'
@@ -1732,7 +1732,7 @@ from pg_locks l join pg_class c on l.relation = c.oid
 where virtualtransaction = (
         select virtualtransaction
         from pg_locks
-        where transactionid = pg_current_xact_id()::xid)
+        where transactionid = pg_current_xact_id()::xid4)
 and locktype = 'relation'
 and relnamespace != (select oid from pg_namespace where nspname = 'pg_catalog')
 and c.relname = 'my_locks'
diff --git a/src/test/regress/sql/groupingsets.sql b/src/test/regress/sql/groupingsets.sql
index 77e196798a..f8c03fa274 100644
--- a/src/test/regress/sql/groupingsets.sql
+++ b/src/test/regress/sql/groupingsets.sql
@@ -32,7 +32,7 @@ copy gstest3 from stdin;
 alter table gstest3 add primary key (a);
 
 create temp table gstest4(id integer, v integer,
-                          unhashable_col bit(4), unsortable_col xid);
+                          unhashable_col bit(4), unsortable_col xid4);
 insert into gstest4
 values (1,1,b'0000','1'), (2,2,b'0001','1'),
        (3,4,b'0010','2'), (4,8,b'0011','2'),
diff --git a/src/test/regress/sql/update.sql b/src/test/regress/sql/update.sql
index 8c558a7bc7..d37140f421 100644
--- a/src/test/regress/sql/update.sql
+++ b/src/test/regress/sql/update.sql
@@ -119,12 +119,12 @@ INSERT INTO upsert_test VALUES (1, 'Bat') ON CONFLICT(a)
 -- https://www.postgresql.org/message-id/73436355-6432-49B1-92ED-1FE4F7E7E100%40finefun.com.au
 INSERT INTO upsert_test VALUES (2, 'Beeble') ON CONFLICT(a)
   DO UPDATE SET (b, a) = (SELECT b || ', Excluded', a from upsert_test i WHERE i.a = excluded.a)
-  RETURNING tableoid::regclass, xmin = pg_current_xact_id()::xid AS xmin_correct, xmax = 0 AS xmax_correct;
+  RETURNING tableoid::regclass, xmin = pg_current_xact_id()::xid4 AS xmin_correct, xmax = 0 AS xmax_correct;
 -- currently xmax is set after a conflict - that's probably not good,
 -- but it seems worthwhile to have to be explicit if that changes.
 INSERT INTO upsert_test VALUES (2, 'Brox') ON CONFLICT(a)
   DO UPDATE SET (b, a) = (SELECT b || ', Excluded', a from upsert_test i WHERE i.a = excluded.a)
-  RETURNING tableoid::regclass, xmin = pg_current_xact_id()::xid AS xmin_correct, xmax = pg_current_xact_id()::xid AS xmax_correct;
+  RETURNING tableoid::regclass, xmin = pg_current_xact_id()::xid4 AS xmin_correct, xmax = pg_current_xact_id()::xid4 AS xmax_correct;
 
 
 DROP TABLE update_test;
diff --git a/src/test/regress/sql/xid.sql b/src/test/regress/sql/xid.sql
index 565714d462..8d9b40fe26 100644
--- a/src/test/regress/sql/xid.sql
+++ b/src/test/regress/sql/xid.sql
@@ -1,36 +1,36 @@
--- xid and xid8
+-- xid4 and xid8
 
 -- values in range, in octal, decimal, hex
-select '010'::xid,
-       '42'::xid,
-       '0xffffffff'::xid,
-       '-1'::xid,
+select '010'::xid4,
+       '42'::xid4,
+       '0xffffffff'::xid4,
+       '-1'::xid4,
 	   '010'::xid8,
 	   '42'::xid8,
 	   '0xffffffffffffffff'::xid8,
 	   '-1'::xid8;
 
 -- garbage values are not yet rejected (perhaps they should be)
-select ''::xid;
-select 'asdf'::xid;
+select ''::xid4;
+select 'asdf'::xid4;
 select ''::xid8;
 select 'asdf'::xid8;
 
 -- equality
-select '1'::xid = '1'::xid;
-select '1'::xid != '1'::xid;
+select '1'::xid4 = '1'::xid4;
+select '1'::xid4 != '1'::xid4;
 select '1'::xid8 = '1'::xid8;
 select '1'::xid8 != '1'::xid8;
 
 -- conversion
-select '1'::xid = '1'::xid8::xid;
-select '1'::xid != '1'::xid8::xid;
-
--- we don't want relational operators for xid, due to use of modular arithmetic
-select '1'::xid < '2'::xid;
-select '1'::xid <= '2'::xid;
-select '1'::xid > '2'::xid;
-select '1'::xid >= '2'::xid;
+select '1'::xid4 = '1'::xid8::xid4;
+select '1'::xid4 != '1'::xid8::xid4;
+
+-- we don't want relational operators for xid4, due to use of modular arithmetic
+select '1'::xid4 < '2'::xid4;
+select '1'::xid4 <= '2'::xid4;
+select '1'::xid4 > '2'::xid4;
+select '1'::xid4 >= '2'::xid4;
 
 -- we want them for xid8 though
 select '1'::xid8 < '2'::xid8, '2'::xid8 < '2'::xid8, '2'::xid8 < '1'::xid8;
-- 
2.20.1

Reply via email to