From 1ebdbe63f923a4272379173566ef0de74b60aa04 Mon Sep 17 00:00:00 2001
From: Baji Shaik <baji.pgdev@gmail.com>
Date: Sun, 10 May 2026 20:20:02 -0500
Subject: [PATCH] Fix psql tab completion for REPACK boolean options

The tab completion for REPACK's parenthesized options (ANALYZE,
CONCURRENTLY, VERBOSE) was using TailMatches with comma-separated
arguments, which matches a sequence of consecutive words. This meant
ON/OFF was never offered after typing one of these option keywords.

Use pipe-separated alternatives in a single TailMatches argument
instead, matching the pattern used by VACUUM's tab completion.

Bug introduced in ac58465e061 (Introduce the REPACK command) and
extended in 28d534e2ae0 (Add CONCURRENTLY option to REPACK).
---
 src/bin/psql/tab-complete.in.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index db65d130fcb..21b8736e9c5 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -5237,7 +5237,7 @@ match_previous_words(int pattern_id,
 		 */
 		if (ends_with(prev_wd, '(') || ends_with(prev_wd, ','))
 			COMPLETE_WITH("ANALYZE", "CONCURRENTLY", "VERBOSE");
-		else if (TailMatches("ANALYZE", "CONCURRENTLY", "VERBOSE"))
+		else if (TailMatches("ANALYZE|CONCURRENTLY|VERBOSE"))
 			COMPLETE_WITH("ON", "OFF");
 	}
 
-- 
2.50.1 (Apple Git-155)

