summaryrefslogtreecommitdiff
path: root/src/backend/commands/subscriptioncmds.c
diff options
context:
space:
mode:
authorÁlvaro Herrera <alvherre@kurilemu.de>2025-11-06 20:33:57 +0100
committerÁlvaro Herrera <alvherre@kurilemu.de>2025-11-06 20:33:57 +0100
commita2b02293bc65dbb2401cb19c724f52c6ee0f2faf (patch)
treef982dafa5b106905027b0e11fe9cdee9fc0bab6f /src/backend/commands/subscriptioncmds.c
parent06edbed478625829b19c35d0c17d805be588afa6 (diff)
Use XLogRecPtrIsValid() in various places
Now that commit 06edbed47862 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
Diffstat (limited to 'src/backend/commands/subscriptioncmds.c')
-rw-r--r--src/backend/commands/subscriptioncmds.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index 3d29818badd..2b0c0ca8d05 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -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",