Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0bf6246

Browse files
author
Amit Kapila
committed
Fix issues in binary_upgrade_logical_slot_has_caught_up().
The commit 29d0a77 labelled binary_upgrade_logical_slot_has_caught_up() as a non-strict function to allow providing a better error message to callers in case the passed slot_name is NULL. On further discussion, it seems that it is not helpful to have a different error message for NULL input in this function, so this patch marks the function as strict. This patch also removes the explicit permission check to use replication slots as this function is invoked only by superusers and instead adds an Assert. Reported-by: Masahiko Sawada Author: Hayato Kuroda Reviewed-by: Vignesh C Discussion: https://postgr.es/m/CAD21AoDSyiBKkMXBxN_gUayZZUCOgyHnG8Ge8rcPXNP3Tf6B4g@mail.gmail.com
1 parent c426f7c commit 0bf6246

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

src/backend/utils/adt/pg_upgrade_support.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,11 @@ binary_upgrade_logical_slot_has_caught_up(PG_FUNCTION_ARGS)
281281

282282
CHECK_IS_BINARY_UPGRADE;
283283

284-
/* We must check before dereferencing the argument */
285-
if (PG_ARGISNULL(0))
286-
elog(ERROR, "null argument to binary_upgrade_validate_wal_records is not allowed");
287-
288-
CheckSlotPermissions();
284+
/*
285+
* Binary upgrades only allowed super-user connections so we must have
286+
* permission to use replication slots.
287+
*/
288+
Assert(has_rolreplication(GetUserId()));
289289

290290
slot_name = PG_GETARG_NAME(0);
291291

src/include/catalog/catversion.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@
5757
*/
5858

5959
/* yyyymmddN */
60-
#define CATALOG_VERSION_NO 202311271
60+
#define CATALOG_VERSION_NO 202312071
6161

6262
#endif

src/include/catalog/pg_proc.dat

+2-3
Original file line numberDiff line numberDiff line change
@@ -11392,9 +11392,8 @@
1139211392
proparallel => 'u', prorettype => 'void', proargtypes => 'oid',
1139311393
prosrc => 'binary_upgrade_set_next_pg_tablespace_oid' },
1139411394
{ oid => '8046', descr => 'for use by pg_upgrade',
11395-
proname => 'binary_upgrade_logical_slot_has_caught_up', proisstrict => 'f',
11396-
provolatile => 'v', proparallel => 'u', prorettype => 'bool',
11397-
proargtypes => 'name',
11395+
proname => 'binary_upgrade_logical_slot_has_caught_up', provolatile => 'v',
11396+
proparallel => 'u', prorettype => 'bool', proargtypes => 'name',
1139811397
prosrc => 'binary_upgrade_logical_slot_has_caught_up' },
1139911398

1140011399
# conversion functions

0 commit comments

Comments
 (0)