fix DECLARE tab completion

Started by Nonameover 4 years ago2 messages
#1Noname
Shinya11.Kato@nttdata.com
1 attachment(s)

Hi!

In the discussion of [1]/messages/by-id/96ee8b30-9889-9e1b-b053-90e10c050e85@enterprisedb.com, the option ASENSITIVE was added to DECLARE.
I have improved its tab completion and attached a patch.

Do you think?

[1]: /messages/by-id/96ee8b30-9889-9e1b-b053-90e10c050e85@enterprisedb.com

Regards,
Shinya Kato

Attachments:

fix_declare_tab_completion.patchapplication/octet-stream; name=fix_declare_tab_completion.patchDownload
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index d6bf725971..3b33e3dce9 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -3048,7 +3048,7 @@ psql_completion(const char *text, int start, int end)
 /* DECLARE */
 
 	/*
-	 * Complete DECLARE <name> with one of BINARY, INSENSITIVE, SCROLL, NO
+	 * Complete DECLARE <name> with one of BINARY, ASENSITIVE, INSENSITIVE, SCROLL, NO
 	 * SCROLL, and CURSOR.
 	 */
 	else if (Matches("DECLARE", MatchAny))
@@ -3063,8 +3063,8 @@ psql_completion(const char *text, int start, int end)
 	 * indicates.
 	 */
 	else if (HeadMatches("DECLARE") && TailMatches("BINARY"))
-		COMPLETE_WITH("INSENSITIVE", "SCROLL", "NO SCROLL", "CURSOR");
-	else if (HeadMatches("DECLARE") && TailMatches("INSENSITIVE"))
+		COMPLETE_WITH("ASENSITIVE", "INSENSITIVE", "SCROLL", "NO SCROLL", "CURSOR");
+	else if (HeadMatches("DECLARE") && TailMatches("ASENSITIVE|INSENSITIVE"))
 		COMPLETE_WITH("SCROLL", "NO SCROLL", "CURSOR");
 	else if (HeadMatches("DECLARE") && TailMatches("SCROLL"))
 		COMPLETE_WITH("CURSOR");
#2Michael Paquier
michael@paquier.xyz
In reply to: Noname (#1)
Re: fix DECLARE tab completion

On Tue, Aug 03, 2021 at 01:58:44AM +0000, Shinya11.Kato@nttdata.com wrote:

In the discussion of [1], the option ASENSITIVE was added to DECLARE.
I have improved its tab completion and attached a patch.

Do you think?

Thanks, fixed.
--
Michael