From eca6d7c098755bcb72f18ddba9a871d90e113131 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 19 Jun 2024 09:13:39 -0700
Subject: [PATCH v2 07/10] windows-tab-complete-workaround

---
 src/bin/psql/tab-complete.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index d453e224d93..8627eba346a 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -1750,6 +1750,7 @@ psql_completion(const char *text, int start, int end)
 	 * commands.  So get the string to look at from rl_line_buffer instead.
 	 */
 	char	   *text_copy = pnstrdup(rl_line_buffer + start, end - start);
+	bool if_continues = false;
 	text = text_copy;
 
 	/* Remember last char of the given input word. */
@@ -3033,7 +3034,16 @@ psql_completion(const char *text, int start, int end)
 	else if (TailMatches("INDEX|CONCURRENTLY", MatchAny, "ON") ||
 			 TailMatches("INDEX|CONCURRENTLY", "ON"))
 		COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexables);
+	else
+		if_continues = true;
 
+	/*
+	 * Complete CREATE|UNIQUE INDEX CONCURRENTLY with "ON" and existing
+	 * indexes
+	 */
+	if (!if_continues)
+	{
+	}
 	/*
 	 * Complete CREATE|UNIQUE INDEX CONCURRENTLY with "ON" and existing
 	 * indexes
-- 
2.44.0.279.g3bd955d269

