Skip to content

Commit 4d5105a

Browse files
Improve error message for pg_create_subscription.
c3afe8c updated this error message, but it didn't use the new style established in de4d456. Reviewed-by: Tom Lane Discussion: https://postgr.es/m/20230512203721.GA2644063%40nathanxps13.home
1 parent 51b2c08 commit 4d5105a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/backend/commands/subscriptioncmds.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,9 @@ CreateSubscription(ParseState *pstate, CreateSubscriptionStmt *stmt,
611611
if (!has_privs_of_role(owner, ROLE_PG_CREATE_SUBSCRIPTION))
612612
ereport(ERROR,
613613
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
614-
errmsg("must have privileges of pg_create_subscription to create subscriptions")));
614+
errmsg("permission denied to create subscription"),
615+
errdetail("Only roles with privileges of the \"%s\" role may create subscriptions.",
616+
"pg_create_subscription")));
615617

616618
/*
617619
* Since a subscription is a database object, we also check for CREATE

src/test/regress/expected/subscription.out

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ ERROR: subscription "regress_testsub" already exists
7979
-- fail - must be superuser
8080
SET SESSION AUTHORIZATION 'regress_subscription_user2';
8181
CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION foo WITH (connect = false);
82-
ERROR: must have privileges of pg_create_subscription to create subscriptions
82+
ERROR: permission denied to create subscription
83+
DETAIL: Only roles with privileges of the "pg_create_subscription" role may create subscriptions.
8384
SET SESSION AUTHORIZATION 'regress_subscription_user';
8485
-- fail - invalid option combinations
8586
CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, copy_data = true);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy