diff options
Diffstat (limited to 'src/backend/utils/adt/txid.c')
-rw-r--r-- | src/backend/utils/adt/txid.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/backend/utils/adt/txid.c b/src/backend/utils/adt/txid.c index a4a5b866768..fe9f7c5d396 100644 --- a/src/backend/utils/adt/txid.c +++ b/src/backend/utils/adt/txid.c @@ -14,7 +14,7 @@ * Author: Jan Wieck, Afilias USA INC. * 64-bit txids: Marko Kreen, Skype Technologies * - * $PostgreSQL: pgsql/src/backend/utils/adt/txid.c,v 1.8 2009/01/01 17:23:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/txid.c,v 1.9 2009/12/19 01:32:36 sriggs Exp $ * *------------------------------------------------------------------------- */ @@ -24,6 +24,7 @@ #include "access/transam.h" #include "access/xact.h" #include "funcapi.h" +#include "miscadmin.h" #include "libpq/pqformat.h" #include "utils/builtins.h" #include "utils/snapmgr.h" @@ -338,6 +339,15 @@ txid_current(PG_FUNCTION_ARGS) txid val; TxidEpoch state; + /* + * Must prevent during recovery because if an xid is + * not assigned we try to assign one, which would fail. + * Programs already rely on this function to always + * return a valid current xid, so we should not change + * this to return NULL or similar invalid xid. + */ + PreventCommandDuringRecovery(); + load_xid_epoch(&state); val = convert_xid(GetTopTransactionId(), &state); |