This is an automated email from the ASF dual-hosted git repository.
reshke pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
The following commit(s) were added to refs/heads/main by this push:
new 0efd878a6e3 Improve the SQL tab-completion feature for resource group
(#1669)
0efd878a6e3 is described below
commit 0efd878a6e3e2d7fa9ec2cf258d612f32d239413
Author: FairyFar <[email protected]>
AuthorDate: Thu Apr 9 20:17:24 2026 +0800
Improve the SQL tab-completion feature for resource group (#1669)
1. For the time being, we will not handle the tab-completion feature of
resource queue because there is a trend for resource group to replace resource
queue.
2. Correct the description of the gp_resource_manager parameter.
---
src/backend/utils/misc/guc_gp.c | 2 +-
src/bin/psql/tab-complete.c | 26 ++++++++++++++++----------
2 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/src/backend/utils/misc/guc_gp.c b/src/backend/utils/misc/guc_gp.c
index 42b61dfbbbb..f846cc24aa3 100644
--- a/src/backend/utils/misc/guc_gp.c
+++ b/src/backend/utils/misc/guc_gp.c
@@ -4936,7 +4936,7 @@ struct config_string ConfigureNamesString_gp[] =
{
{"gp_resource_manager", PGC_POSTMASTER, RESOURCES,
gettext_noop("Sets the type of resource manager."),
- gettext_noop("Only support \"queue\" and \"group\" for
now.")
+ gettext_noop("Only support \"queue\", \"group\" and
\"group-v2\" for now.")
},
&gp_resource_manager_str,
"queue",
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 3593b78577d..259f5807620 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -1614,6 +1614,12 @@ psql_completion(const char *text, int start, int end)
NULL
};
+ static const char *const list_resource_group_type[] = {
+ "CONCURRENCY", "CPU_MAX_PERCENT", "CPUSET", "CPU_WEIGHT",
+ "MEMORY_QUOTA", "MIN_COST", "IO_LIMIT",
+ NULL
+ };
+
/*
* Temporary workaround for a bug in recent (2019) libedit: it
incorrectly
* de-escapes the input "text", causing us to fail to recognize
backslash
@@ -3115,8 +3121,8 @@ psql_completion(const char *text, int start, int end)
else if (Matches("CREATE", "ROLE|USER|GROUP", MatchAny, "IN"))
COMPLETE_WITH("GROUP", "ROLE");
-/* CREATE/DROP RESOURCE GROUP/QUEUE */
- else if (Matches("CREATE|DROP", "RESOURCE"))
+/* CREATE/DROP/ALTER RESOURCE GROUP/QUEUE */
+ else if (Matches("CREATE|DROP|ALTER", "RESOURCE"))
{
static const char *const list_CREATERESOURCEGROUP[] =
{"GROUP", "QUEUE", NULL};
@@ -3130,19 +3136,19 @@ psql_completion(const char *text, int start, int end)
else if (Matches("CREATE", "PROFILE", MatchAny, "LIMIT"))
COMPLETE_WITH("FAILED_LOGIN_ATTEMPTS", "PASSWORD_REUSE_MAX",
"PASSWORD_LOCK_TIME");
- /* CREATE/DROP RESOURCE GROUP */
- else if (TailMatches("CREATE|DROP", "RESOURCE", "GROUP"))
+ /* CREATE/DROP/ALTER RESOURCE GROUP */
+ else if (TailMatches("CREATE|DROP|ALTER", "RESOURCE", "GROUP"))
COMPLETE_WITH_QUERY(Query_for_list_of_resgroups);
/* CREATE RESOURCE GROUP <name> */
else if (TailMatches("CREATE|DROP", "RESOURCE", "GROUP", MatchAny))
COMPLETE_WITH("WITH (");
+ /* ALTER RESOURCE GROUP <name> */
+ else if (TailMatches("ALTER", "RESOURCE", "GROUP", MatchAny))
+ COMPLETE_WITH("SET");
+ else if (TailMatches("ALTER", "RESOURCE", "GROUP", MatchAny, "SET"))
+ COMPLETE_WITH_LIST(list_resource_group_type);
else if (TailMatches("RESOURCE", "GROUP", MatchAny, "WITH", "("))
- {
- static const char *const list_CREATERESOURCEGROUP[] =
- {"CONCURRENCY", "CPU_MAX_PERCENT", "CPUSET", "CPU_WEIGHT",
"MEMORY_QUOTA", "MIN_COST", "IO_LIMIT", NULL};
-
- COMPLETE_WITH_LIST(list_CREATERESOURCEGROUP);
- }
+ COMPLETE_WITH_LIST(list_resource_group_type);
/* CREATE TYPE */
else if (Matches("CREATE", "TYPE", MatchAny))
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]