This is an automated email from the ASF dual-hosted git repository.

oppenheimer01 pushed a commit to branch cbdb-postgres-merge
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 36770183e6e86a03e0eeeb7b32f26de0a88c9ea4
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 c83b0408be0..50ff4194684 100644
--- a/src/backend/utils/misc/guc_gp.c
+++ b/src/backend/utils/misc/guc_gp.c
@@ -4927,7 +4927,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 3096e0a396f..0283a9424c4 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -1778,6 +1778,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
@@ -3585,8 +3591,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};
@@ -3600,19 +3606,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]

Reply via email to