Introduce xid8-based functions to replace txid_XXX.
authorThomas Munro <tmunro@postgresql.org>
Mon, 6 Apr 2020 23:33:56 +0000 (11:33 +1200)
committerThomas Munro <tmunro@postgresql.org>
Tue, 7 Apr 2020 00:04:32 +0000 (12:04 +1200)
commit4c04be9b05ad2ec5acd27c3417bf075c13cab134
treea85e0f90b3b5fd059b4155d93f00bf58f54955ca
parentaeec457de8a8820368e343e791accffe24dc7198
Introduce xid8-based functions to replace txid_XXX.

The txid_XXX family of fmgr functions exposes 64 bit transaction IDs to
users as int8.  Now that we have an SQL type xid8 for FullTransactionId,
define a new set of functions including pg_current_xact_id() and
pg_current_snapshot() based on that.  Keep the old functions around too,
for now.

It's a bit sneaky to use the same C functions for both, but since the
binary representation is identical except for the signedness of the
type, and since older functions are the ones using the wrong signedness,
and since we'll presumably drop the older ones after a reasonable period
of time, it seems reasonable to switch to FullTransactionId internally
and share the code for both.

Reviewed-by: Fujii Masao <masao.fujii@oss.nttdata.com>
Reviewed-by: Takao Fujii <btfujiitkp@oss.nttdata.com>
Reviewed-by: Yoshikazu Imai <imai.yoshikazu@fujitsu.com>
Reviewed-by: Mark Dilger <mark.dilger@enterprisedb.com>
Discussion: https://postgr.es/m/20190725000636.666m5mad25wfbrri%40alap3.anarazel.de
36 files changed:
contrib/test_decoding/expected/ddl.out
contrib/test_decoding/expected/decoding_in_xact.out
contrib/test_decoding/expected/oldest_xmin.out
contrib/test_decoding/expected/ondisk_startup.out
contrib/test_decoding/expected/snapshot_transfer.out
contrib/test_decoding/specs/oldest_xmin.spec
contrib/test_decoding/specs/ondisk_startup.spec
contrib/test_decoding/specs/snapshot_transfer.spec
contrib/test_decoding/sql/ddl.sql
contrib/test_decoding/sql/decoding_in_xact.sql
doc/src/sgml/datatype.sgml
doc/src/sgml/func.sgml
doc/src/sgml/logicaldecoding.sgml
doc/src/sgml/monitoring.sgml
src/backend/utils/adt/Makefile
src/backend/utils/adt/xid8funcs.c [moved from src/backend/utils/adt/txid.c with 54% similarity]
src/include/catalog/catversion.h
src/include/catalog/pg_proc.dat
src/include/catalog/pg_type.dat
src/test/modules/commit_ts/t/004_restart.pl
src/test/modules/test_ddl_deparse/expected/create_table.out
src/test/modules/test_ddl_deparse/sql/create_table.sql
src/test/recovery/t/003_recovery_targets.pl
src/test/recovery/t/011_crash_recovery.pl
src/test/regress/expected/alter_table.out
src/test/regress/expected/hs_standby_functions.out
src/test/regress/expected/opr_sanity.out
src/test/regress/expected/txid.out
src/test/regress/expected/update.out
src/test/regress/expected/xid.out
src/test/regress/sql/alter_table.sql
src/test/regress/sql/hs_standby_functions.sql
src/test/regress/sql/txid.sql
src/test/regress/sql/update.sql
src/test/regress/sql/xid.sql
src/tools/pgindent/typedefs.list