Skip to content

Commit 9aa58d4

Browse files
committed
Add a few new patterns to the tab completion of psql
This improves the tab completion of psql on a few points: - Provide a list of subscriptions on \dRs. - Provide a list of publications on \dRp. - Add CURRENT_ROLE, CURRENT_USER, SESSION_USER when OWNER TO is provided at the end of a query (as defined by RoleSpec in gram.y). Author: Vignesh C Reviewed-by: Dagfinn Ilmari Mannsåker Discussion: https://postgr.es/m/CALDaNm3toRBt6c6saY3174f7CsGztXRvVvfWbikkJEXY7x5WAA@mail.gmail.com
1 parent bdf9b60 commit 9aa58d4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/bin/psql/tab-complete.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4160,7 +4160,10 @@ psql_completion(const char *text, int start, int end)
41604160

41614161
/* OWNER TO - complete with available roles */
41624162
else if (TailMatches("OWNER", "TO"))
4163-
COMPLETE_WITH_QUERY(Query_for_list_of_roles);
4163+
COMPLETE_WITH_QUERY_PLUS(Query_for_list_of_roles,
4164+
"CURRENT_ROLE",
4165+
"CURRENT_USER",
4166+
"SESSION_USER");
41644167

41654168
/* ORDER BY */
41664169
else if (TailMatches("FROM", MatchAny, "ORDER"))
@@ -4614,6 +4617,10 @@ psql_completion(const char *text, int start, int end)
46144617
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_tables);
46154618
else if (TailMatchesCS("\\dP*"))
46164619
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
4620+
else if (TailMatchesCS("\\dRp*"))
4621+
COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
4622+
else if (TailMatchesCS("\\dRs*"))
4623+
COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
46174624
else if (TailMatchesCS("\\ds*"))
46184625
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
46194626
else if (TailMatchesCS("\\dt*"))

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