From: Robert Haas Date: Mon, 9 Sep 2013 20:25:29 +0000 (-0400) Subject: Introduce InvalidCommandId. X-Git-Tag: REL9_4_BETA1~1158 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=71901ab6d;p=postgresql Introduce InvalidCommandId. This allows a 32-bit field to represent an *optional* command ID without a separate flag bit. Andres Freund --- diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 31e868d4bc..0591f3fd56 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -766,12 +766,12 @@ CommandCounterIncrement(void) if (currentCommandIdUsed) { currentCommandId += 1; - if (currentCommandId == FirstCommandId) /* check for overflow */ + if (currentCommandId == InvalidCommandId) { currentCommandId -= 1; ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("cannot have more than 2^32-1 commands in a transaction"))); + errmsg("cannot have more than 2^32-2 commands in a transaction"))); } currentCommandIdUsed = false; diff --git a/src/include/c.h b/src/include/c.h index 596118342d..14bfdcd4da 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -368,6 +368,7 @@ typedef uint32 MultiXactOffset; typedef uint32 CommandId; #define FirstCommandId ((CommandId) 0) +#define InvalidCommandId (~(CommandId)0) /* * Array indexing support