From 4c4854c4583f1d7c3d0a28b714304e433f5571e8 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Thu, 15 Aug 2002 02:49:04 +0000
Subject: [PATCH] The second enables tab-complete to analyze.  It ignores
 schema stuff (so does every tab-completion command AFAICS)

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

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index e7fd3df45f9..93c5b39a20d 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -3,7 +3,7 @@
  *
  * Copyright 2000-2002 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.56 2002/08/10 03:56:24 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.57 2002/08/15 02:49:04 momjian Exp $
  */
 
 /*----------------------------------------------------------------------
@@ -358,6 +358,14 @@ psql_completion(char *text, int start, int end)
 			 && strcasecmp(prev_wd, "USER") == 0)
 		COMPLETE_WITH_QUERY(Query_for_list_of_users);
 
+/* ANALYZE */
+	/* If the previous word is ANALYZE, produce list of tables. */
+	else if (strcasecmp(prev_wd, "ANALYZE") == 0)
+		COMPLETE_WITH_QUERY(Query_for_list_of_tables);
+	/* If we have ANALYZE <table>, complete with semicolon. */
+	else if (strcasecmp(prev2_wd, "ANALYZE") == 0)
+		COMPLETE_WITH_CONST(";");
+
 /* CLUSTER */
 	/* If the previous word is CLUSTER, produce list of indexes. */
 	else if (strcasecmp(prev_wd, "CLUSTER") == 0)
-- 
GitLab