Fix incorrect assertion in libpqwalreceiver
authorHeikki Linnakangas <[email protected]>
Sun, 9 Mar 2025 18:40:45 +0000 (20:40 +0200)
committerHeikki Linnakangas <[email protected]>
Sun, 9 Mar 2025 18:40:45 +0000 (20:40 +0200)
Was supposed to check the length of the array, but was checking its
size in bytes.

Author: Jacob Brazeal <[email protected]>
Discussion: https://www.postgresql.org/message-id/CA%2BCOZaA_9afJxj9ZuO73U5P7WXP%2BZM9NGnZvTDCmBFz0FGP%[email protected]

src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

index 1b158c9d2886ff986735253b3b39ba9519599a3e..c650935ef5d74244c650ab2c8f9e8301a13cc13b 100644 (file)
@@ -208,7 +208,7 @@ libpqrcv_connect(const char *conninfo, bool replication, bool logical,
    keys[++i] = NULL;
    vals[i] = NULL;
 
-   Assert(i < sizeof(keys));
+   Assert(i < lengthof(keys));
 
    conn = palloc0(sizeof(WalReceiverConn));
    conn->streamConn = PQconnectStartParams(keys, vals,