mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
Use XLogRecPtrIsValid() in various places
Now that commit 06edbed478 has introduced XLogRecPtrIsValid(), we can
use that instead of:
- XLogRecPtrIsInvalid()
- direct comparisons with InvalidXLogRecPtr
- direct comparisons with literal 0
This makes the code more consistent.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aQB7EvGqrbZXrMlg@ip-10-97-1-34.eu-west-3.compute.internal
This commit is contained in:
@@ -393,7 +393,7 @@ parse_subscription_options(ParseState *pstate, List *stmt_options,
|
||||
lsn = DatumGetLSN(DirectFunctionCall1(pg_lsn_in,
|
||||
CStringGetDatum(lsn_str)));
|
||||
|
||||
if (XLogRecPtrIsInvalid(lsn))
|
||||
if (!XLogRecPtrIsValid(lsn))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("invalid WAL location (LSN): %s", lsn_str)));
|
||||
@@ -1895,7 +1895,7 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
|
||||
* If the user sets subskiplsn, we do a sanity check to make
|
||||
* sure that the specified LSN is a probable value.
|
||||
*/
|
||||
if (!XLogRecPtrIsInvalid(opts.lsn))
|
||||
if (XLogRecPtrIsValid(opts.lsn))
|
||||
{
|
||||
RepOriginId originid;
|
||||
char originname[NAMEDATALEN];
|
||||
@@ -1907,7 +1907,7 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
|
||||
remote_lsn = replorigin_get_progress(originid, false);
|
||||
|
||||
/* Check the given LSN is at least a future LSN */
|
||||
if (!XLogRecPtrIsInvalid(remote_lsn) && opts.lsn < remote_lsn)
|
||||
if (XLogRecPtrIsValid(remote_lsn) && opts.lsn < remote_lsn)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("skip WAL location (LSN %X/%08X) must be greater than origin LSN %X/%08X",
|
||||
|
||||
Reference in New Issue
Block a user