Skip to content

Commit 8176afd

Browse files
committed
Improve tab-completion for FETCH/MOVE.
Author: Naoki Nakamichi Reviewed-by: Fujii Masao Discussion: https://postgr.es/m/d05a46b599634ca0d94144387507f4b4@oss.nttdata.com
1 parent 110d817 commit 8176afd

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/bin/psql/tab-complete.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3077,19 +3077,27 @@ psql_completion(const char *text, int start, int end)
30773077
COMPLETE_WITH("SELECT", "INSERT", "DELETE", "UPDATE", "DECLARE");
30783078

30793079
/* FETCH && MOVE */
3080-
/* Complete FETCH with one of FORWARD, BACKWARD, RELATIVE */
3080+
3081+
/*
3082+
* Complete FETCH with one of ABSOLUTE, BACKWARD, FORWARD, RELATIVE, ALL,
3083+
* NEXT, PRIOR, FIRST, LAST
3084+
*/
30813085
else if (Matches("FETCH|MOVE"))
3082-
COMPLETE_WITH("ABSOLUTE", "BACKWARD", "FORWARD", "RELATIVE");
3083-
/* Complete FETCH <sth> with one of ALL, NEXT, PRIOR */
3084-
else if (Matches("FETCH|MOVE", MatchAny))
3085-
COMPLETE_WITH("ALL", "NEXT", "PRIOR");
3086+
COMPLETE_WITH("ABSOLUTE", "BACKWARD", "FORWARD", "RELATIVE",
3087+
"ALL", "NEXT", "PRIOR", "FIRST", "LAST");
3088+
3089+
/* Complete FETCH BACKWARD or FORWARD with one of ALL, FROM, IN */
3090+
else if (Matches("FETCH|MOVE", "BACKWARD|FORWARD"))
3091+
COMPLETE_WITH("ALL", "FROM", "IN");
30863092

30873093
/*
3088-
* Complete FETCH <sth1> <sth2> with "FROM" or "IN". These are equivalent,
3094+
* Complete FETCH <direction> with "FROM" or "IN". These are equivalent,
30893095
* but we may as well tab-complete both: perhaps some users prefer one
30903096
* variant or the other.
30913097
*/
3092-
else if (Matches("FETCH|MOVE", MatchAny, MatchAny))
3098+
else if (Matches("FETCH|MOVE", "ABSOLUTE|BACKWARD|FORWARD|RELATIVE",
3099+
MatchAnyExcept("FROM|IN")) ||
3100+
Matches("FETCH|MOVE", "ALL|NEXT|PRIOR|FIRST|LAST"))
30933101
COMPLETE_WITH("FROM", "IN");
30943102

30953103
/* FOREIGN DATA WRAPPER */

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