mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +03:00
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:
parent
9c68834bfc
commit
71901ab6da
@ -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;
|
||||
|
||||
|
@ -368,6 +368,7 @@ typedef uint32 MultiXactOffset;
|
||||
typedef uint32 CommandId;
|
||||
|
||||
#define FirstCommandId ((CommandId) 0)
|
||||
#define InvalidCommandId (~(CommandId)0)
|
||||
|
||||
/*
|
||||
* Array indexing support
|
||||
|
Loading…
x
Reference in New Issue
Block a user