Skip to content

Commit 1d15d0d

Browse files
committed
psql: Tab-complete LOCK [TABLE] ... IN {ACCESS|ROW|SHARE}.
Suggest the lock modes that begin with the word in question. Thomas Munro, reviewed by Marllius Ribeiro. Comments tweaked by me.
1 parent c6ff380 commit 1d15d0d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/bin/psql/tab-complete.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2662,6 +2662,17 @@ psql_completion(const char *text, int start, int end)
26622662
"SHARE ROW EXCLUSIVE MODE",
26632663
"EXCLUSIVE MODE", "ACCESS EXCLUSIVE MODE");
26642664

2665+
/* Complete LOCK [TABLE] <table> IN ACCESS|ROW with rest of lock mode */
2666+
else if (Matches4("LOCK", MatchAny, "IN", "ACCESS|ROW") ||
2667+
Matches5("LOCK", "TABLE", MatchAny, "IN", "ACCESS|ROW"))
2668+
COMPLETE_WITH_LIST2("EXCLUSIVE MODE", "SHARE MODE");
2669+
2670+
/* Complete LOCK [TABLE] <table> IN SHARE with rest of lock mode */
2671+
else if (Matches4("LOCK", MatchAny, "IN", "SHARE") ||
2672+
Matches5("LOCK", "TABLE", MatchAny, "IN", "SHARE"))
2673+
COMPLETE_WITH_LIST3("MODE", "ROW EXCLUSIVE MODE",
2674+
"UPDATE EXCLUSIVE MODE");
2675+
26652676
/* NOTIFY --- can be inside EXPLAIN, RULE, etc */
26662677
else if (TailMatches1("NOTIFY"))
26672678
COMPLETE_WITH_QUERY("SELECT pg_catalog.quote_ident(channel) FROM pg_catalog.pg_listening_channels() AS channel WHERE substring(pg_catalog.quote_ident(channel),1,%d)='%s'");

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