Introduce InvalidCommandId.

This allows a 32-bit field to represent an *optional* command ID
without a separate flag bit.

Andres Freund
This commit is contained in:
Robert Haas 2013-09-09 16:25:29 -04:00
parent 9c68834bfc
commit 71901ab6da
2 changed files with 3 additions and 2 deletions

View File

@ -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;

View File

@ -368,6 +368,7 @@ typedef uint32 MultiXactOffset;
typedef uint32 CommandId;
#define FirstCommandId ((CommandId) 0)
#define InvalidCommandId (~(CommandId)0)
/*
* Array indexing support