diff options
author | Robert Haas <rhaas@postgresql.org> | 2013-09-09 16:25:29 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2013-09-09 16:25:29 -0400 |
commit | 71901ab6daaad65c0168c05e016e4208efe5b71a (patch) | |
tree | 18428bbfda8a7bac64017a9de65c38563aa61ea6 | |
parent | 9c68834bfc2ab6e782f56ee3dc7b4949857b8729 (diff) | |
download | postgresql-71901ab6daaad65c0168c05e016e4208efe5b71a.tar.gz postgresql-71901ab6daaad65c0168c05e016e4208efe5b71a.zip |
Introduce InvalidCommandId.
This allows a 32-bit field to represent an *optional* command ID
without a separate flag bit.
Andres Freund
-rw-r--r-- | src/backend/access/transam/xact.c | 4 | ||||
-rw-r--r-- | src/include/c.h | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 31e868d4bc7..0591f3fd562 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 596118342df..14bfdcd4dab 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 |