Skip to content

Commit e3679bc

Browse files
committed
pg_resetwal: Corrections around -c option
The present pg_resetwal code hardcodes the minimum value for -c as 2, which is FrozenTransactionId, but it's not clear why that is allowed. After some research, it was probably a mistake in the original patch. Change it to FirstNormalTransactionId, which matches other xid-related options in pg_resetwal. Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org> Discussion: https://www.postgresql.org/message-id/flat/d09f0e91-8757-642b-1a92-da9a52f5589a%40eisentraut.org
1 parent 1d91d24 commit e3679bc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/bin/pg_resetwal/pg_resetwal.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,13 @@ main(int argc, char *argv[])
211211
exit(1);
212212
}
213213

214-
if (set_oldest_commit_ts_xid < 2 &&
215-
set_oldest_commit_ts_xid != 0)
216-
pg_fatal("transaction ID (-c) must be either 0 or greater than or equal to 2");
214+
if (set_oldest_commit_ts_xid < FirstNormalTransactionId &&
215+
set_oldest_commit_ts_xid != InvalidTransactionId)
216+
pg_fatal("transaction ID (-c) must be either %u or greater than or equal to %u", InvalidTransactionId, FirstNormalTransactionId);
217217

218-
if (set_newest_commit_ts_xid < 2 &&
219-
set_newest_commit_ts_xid != 0)
220-
pg_fatal("transaction ID (-c) must be either 0 or greater than or equal to 2");
218+
if (set_newest_commit_ts_xid < FirstNormalTransactionId &&
219+
set_newest_commit_ts_xid != InvalidTransactionId)
220+
pg_fatal("transaction ID (-c) must be either %u or greater than or equal to %u", InvalidTransactionId, FirstNormalTransactionId);
221221
break;
222222

223223
case 'o':

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy