Skip to content

Commit dd26a0a

Browse files
committed
Use PG_GETARG_TRANSACTIONID where appropriate
Some places were using PG_GETARG_UINT32 where PG_GETARG_TRANSACTIONID would be more appropriate. (Of course, they are the same internally, so there is no externally visible effect.) To do that, export PG_GETARG_TRANSACTIONID outside of xid.c. We also export PG_RETURN_TRANSACTIONID for symmetry, even though there are currently no external users. Author: Ashutosh Bapat <ashutosh.bapat@2ndquadrant.com> Discussion: https://www.postgresql.org/message-id/flat/d8f6bdd536df403b9b33816e9f7e0b9d@G08CNEXMBPEKD05.g08.fujitsu.local
1 parent 5b3dca0 commit dd26a0a

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

src/backend/access/transam/commit_ts.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ error_commit_ts_disabled(void)
404404
Datum
405405
pg_xact_commit_timestamp(PG_FUNCTION_ARGS)
406406
{
407-
TransactionId xid = PG_GETARG_UINT32(0);
407+
TransactionId xid = PG_GETARG_TRANSACTIONID(0);
408408
TimestampTz ts;
409409
bool found;
410410

@@ -481,7 +481,7 @@ pg_last_committed_xact(PG_FUNCTION_ARGS)
481481
Datum
482482
pg_xact_commit_timestamp_origin(PG_FUNCTION_ARGS)
483483
{
484-
TransactionId xid = PG_GETARG_UINT32(0);
484+
TransactionId xid = PG_GETARG_TRANSACTIONID(0);
485485
RepOriginId nodeid;
486486
TimestampTz ts;
487487
Datum values[2];

src/backend/access/transam/multixact.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3339,7 +3339,7 @@ pg_get_multixact_members(PG_FUNCTION_ARGS)
33393339
int nmembers;
33403340
int iter;
33413341
} mxact;
3342-
MultiXactId mxid = PG_GETARG_UINT32(0);
3342+
MultiXactId mxid = PG_GETARG_TRANSACTIONID(0);
33433343
mxact *multi;
33443344
FuncCallContext *funccxt;
33453345

src/backend/utils/adt/xid.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
#include "utils/builtins.h"
2424
#include "utils/xid8.h"
2525

26-
#define PG_GETARG_TRANSACTIONID(n) DatumGetTransactionId(PG_GETARG_DATUM(n))
27-
#define PG_RETURN_TRANSACTIONID(x) return TransactionIdGetDatum(x)
28-
2926
#define PG_GETARG_COMMANDID(n) DatumGetCommandId(PG_GETARG_DATUM(n))
3027
#define PG_RETURN_COMMANDID(x) return CommandIdGetDatum(x)
3128

src/include/fmgr.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ extern struct varlena *pg_detoast_datum_packed(struct varlena *datum);
276276
#define PG_GETARG_POINTER(n) DatumGetPointer(PG_GETARG_DATUM(n))
277277
#define PG_GETARG_CSTRING(n) DatumGetCString(PG_GETARG_DATUM(n))
278278
#define PG_GETARG_NAME(n) DatumGetName(PG_GETARG_DATUM(n))
279+
#define PG_GETARG_TRANSACTIONID(n) DatumGetTransactionId(PG_GETARG_DATUM(n))
279280
/* these macros hide the pass-by-reference-ness of the datatype: */
280281
#define PG_GETARG_FLOAT4(n) DatumGetFloat4(PG_GETARG_DATUM(n))
281282
#define PG_GETARG_FLOAT8(n) DatumGetFloat8(PG_GETARG_DATUM(n))
@@ -360,6 +361,7 @@ extern struct varlena *pg_detoast_datum_packed(struct varlena *datum);
360361
#define PG_RETURN_POINTER(x) return PointerGetDatum(x)
361362
#define PG_RETURN_CSTRING(x) return CStringGetDatum(x)
362363
#define PG_RETURN_NAME(x) return NameGetDatum(x)
364+
#define PG_RETURN_TRANSACTIONID(x) return TransactionIdGetDatum(x)
363365
/* these macros hide the pass-by-reference-ness of the datatype: */
364366
#define PG_RETURN_FLOAT4(x) return Float4GetDatum(x)
365367
#define PG_RETURN_FLOAT8(x) return Float8GetDatum(x)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy