From 3d96551320a923bb00c33e690bb0682a9c563b16 Mon Sep 17 00:00:00 2001 From: Minghui Yang Date: Tue, 17 Sep 2024 18:42:57 +0000 Subject: [PATCH] [BACKPORT 2024.1][#23786] YSQL: add yb_make_next_ddl_statement_nonincrementing to YbDbAdminVariables Summary: The yb_make_next_ddl_statement_nonincrementing has PGC_SUSET and needs to be added to YbDbAdminVariables in order for yb_db_admin role to set it. Otherwise, we see permission denied error for yb_db_admin: ``` yugabyte=# set role yb_db_admin; SET yugabyte=> set yb_make_next_ddl_statement_nonincrementing to true; ERROR: permission denied to set parameter "yb_make_next_ddl_statement_nonincrementing" ``` I added yb_make_next_ddl_statement_nonincrementing to YbDbAdminVariables, and the above error is gone ``` yugabyte=# set role yb_db_admin; SET yugabyte=> set yb_make_next_ddl_statement_nonincrementing to true; SET ``` Jira: DB-12689 Original commit: 2beb87297e96171ba5071a185bb0890b87001d83 / D38135 Test Plan: ./yb_build.sh --cxx-test pg_catalog_version-test --gtest_filter PgCatalogVersionTest.NonIncrementingDDLMode Reviewers: kfranz Reviewed By: kfranz Subscribers: yql Differential Revision: https://phorge.dev.yugabyte.com/D38174 --- src/postgres/src/backend/utils/misc/guc.c | 1 + src/yb/yql/pgwrapper/pg_catalog_version-test.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/src/postgres/src/backend/utils/misc/guc.c b/src/postgres/src/backend/utils/misc/guc.c index deb16ee10b87..a3e97af72dc3 100644 --- a/src/postgres/src/backend/utils/misc/guc.c +++ b/src/postgres/src/backend/utils/misc/guc.c @@ -5537,6 +5537,7 @@ static const char *const map_old_guc_names[] = { static const char *const YbDbAdminVariables[] = { "session_replication_role", "yb_make_next_ddl_statement_nonbreaking", + "yb_make_next_ddl_statement_nonincrementing", }; diff --git a/src/yb/yql/pgwrapper/pg_catalog_version-test.cc b/src/yb/yql/pgwrapper/pg_catalog_version-test.cc index f92cf4fa726d..9f41bc310633 100644 --- a/src/yb/yql/pgwrapper/pg_catalog_version-test.cc +++ b/src/yb/yql/pgwrapper/pg_catalog_version-test.cc @@ -1531,6 +1531,7 @@ TEST_F(PgCatalogVersionTest, NonIncrementingDDLMode) { const string kDatabaseName = "yugabyte"; auto conn = ASSERT_RESULT(ConnectToDB(kDatabaseName)); + ASSERT_OK(conn.Execute("SET ROLE yb_db_admin")); ASSERT_OK(conn.Execute("CREATE TABLE t1(a int)")); auto version = ASSERT_RESULT(GetCatalogVersion(&conn));