Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteb158e7

Browse files
author
Amit Kapila
committed
Don't allow to set replication slot_name as ''.
We don't allow to create replication slot_name as an empty string ('') viaSQL API pg_create_logical_replication_slot() but it is allowed to be setvia Alter Subscription command. This will lead to apply worker repeatedlykeep trying to stream data via slot_name '' and the user is not allowed tocreate the slot with that name.Author: Japin LiReviewed-By: Ranier Vilela, Amit KapilaBackpatch-through: 10, where it was introducedDiscussion:https://postgr.es/m/MEYP282MB1669CBD98E721C77CA696499B61A9@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
1 parent36b607c commiteb158e7

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

‎src/backend/commands/subscriptioncmds.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
#include"replication/logicallauncher.h"
4141
#include"replication/origin.h"
42+
#include"replication/slot.h"
4243
#include"replication/walreceiver.h"
4344
#include"replication/walsender.h"
4445
#include"replication/worker_internal.h"
@@ -145,6 +146,8 @@ parse_subscription_options(List *options, bool *connect, bool *enabled_given,
145146
/* Setting slot_name = NONE is treated as no slot name. */
146147
if (strcmp(*slot_name,"none")==0)
147148
*slot_name=NULL;
149+
else
150+
ReplicationSlotValidateName(*slot_name,ERROR);
148151
}
149152
elseif (strcmp(defel->defname,"copy_data")==0&&copy_data)
150153
{

‎src/test/regress/expected/subscription.out

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ ALTER SUBSCRIPTION testsub SET PUBLICATION testpub2, testpub3 WITH (refresh = fa
8686
ALTER SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist2';
8787
ALTER SUBSCRIPTION testsub SET (slot_name = 'newname');
8888
-- fail
89+
ALTER SUBSCRIPTION testsub SET (slot_name = '');
90+
ERROR: replication slot name "" is too short
91+
-- fail
8992
ALTER SUBSCRIPTION doesnotexist CONNECTION 'dbname=doesnotexist2';
9093
ERROR: subscription "doesnotexist" does not exist
9194
ALTER SUBSCRIPTION testsub SET (create_slot = false);

‎src/test/regress/sql/subscription.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ ALTER SUBSCRIPTION testsub SET PUBLICATION testpub2, testpub3 WITH (refresh = fa
6565
ALTER SUBSCRIPTION testsub CONNECTION'dbname=doesnotexist2';
6666
ALTER SUBSCRIPTION testsubSET (slot_name='newname');
6767

68+
-- fail
69+
ALTER SUBSCRIPTION testsubSET (slot_name='');
70+
6871
-- fail
6972
ALTER SUBSCRIPTION doesnotexist CONNECTION'dbname=doesnotexist2';
7073
ALTER SUBSCRIPTION testsubSET (create_slot= false);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp