From 58aebeda0c2161598b58f468d3c46b113651fb79 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org>
Date: Thu, 25 Jul 2024 14:33:14 +0100
Subject: [PATCH v2] Don't tab complete MATERIALIZED VIEW after CREATE UNLOGGED

When materialized views were originally added in commit 3bf3ab8c5636,
they could be unlogged, so the tab completion was added. However, when
commit 3223b25ff73 banned them, the tab completion was not updated to
match.
---
 src/bin/psql/tab-complete.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 891face1b6..024469474d 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -3267,15 +3267,9 @@ psql_completion(const char *text, int start, int end)
 	/* Complete "CREATE TEMP/TEMPORARY" with the possible temp objects */
 	else if (TailMatches("CREATE", "TEMP|TEMPORARY"))
 		COMPLETE_WITH("SEQUENCE", "TABLE", "VIEW");
-	/* Complete "CREATE UNLOGGED" with TABLE, SEQUENCE or MATVIEW */
+	/* Complete "CREATE UNLOGGED" with TABLE or SEQUENCE */
 	else if (TailMatches("CREATE", "UNLOGGED"))
-	{
-		/* but not MATVIEW in CREATE SCHEMA */
-		if (HeadMatches("CREATE", "SCHEMA"))
-			COMPLETE_WITH("TABLE", "SEQUENCE");
-		else
-			COMPLETE_WITH("TABLE", "SEQUENCE", "MATERIALIZED VIEW");
-	}
+		COMPLETE_WITH("TABLE", "SEQUENCE");
 	/* Complete PARTITION BY with RANGE ( or LIST ( or ... */
 	else if (TailMatches("PARTITION", "BY"))
 		COMPLETE_WITH("RANGE (", "LIST (", "HASH (");
-- 
2.39.2

