Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fvQ3K-0007cs-Ow for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Aug 2018 16:44:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fvQ3J-0000kg-97 for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Aug 2018 16:44:13 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fvQ3I-0000kY-V9 for pgsql-hackers@lists.postgresql.org; Thu, 30 Aug 2018 16:44:13 +0000 Received: from ping.uio.no ([2001:700:100:570::196]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fvQ3F-0008Vj-L4 for pgsql-hackers@postgresql.org; Thu, 30 Aug 2018 16:44:11 +0000 Received: from [2001:700:100:570::211] (helo=dalvik.ping.uio.no ident=Debian-exim) by ping.uio.no with esmtp (Exim 4.72 #1 (Debian)) id 1fvQ38-0007uY-KW for ; Thu, 30 Aug 2018 18:44:04 +0200 Received: from ilmari by dalvik.ping.uio.no with local (Exim 4.84_2) (envelope-from ) id 1fvQ38-000777-GD for pgsql-hackers@postgresql.org; Thu, 30 Aug 2018 18:44:02 +0200 From: ilmari@ilmari.org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=) To: pgsql-hackers@postgresql.org Subject: [PATCH] Tab completion for ALTER DATABASE =?utf-8?Q?=E2=80=A6?= SET TABLESPACE Date: Thu, 30 Aug 2018 17:44:02 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Exiscan-Spam-Score: -3.7 (---) X-Exiscan-Spam-Report: SpamAssassin 3.3.1 (2010-03-16) on pike.ping.uio.no Score Rule * -5.0 PING_UIO_MAIL_IS_INTERNAL Message has never been outside * 129.240.0.0/16 or 193.157.115.0/24 * 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi hackers, I just noticed that psql's tab completion for ALTER TABLE … SET TABLESPACE was treating it as any other configuration parameter and completing with FROM DEFAULT or TO after it, instead of a list of tablespaces. PFA a patch that fixes this. - ilmari -- "A disappointingly low fraction of the human race is, at any given time, on fire." - Stig Sandbeck Mathisen --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Fix-tab-completion-for-ALTER-TABLE-SET-TABLESPACE.patch From a72d9dc1f38606a0bca8ff29b561915b8cbe9d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= Date: Thu, 30 Aug 2018 17:36:16 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20tab=20completion=20for=20ALTER=20TABLE=20?= =?UTF-8?q?=E2=80=A6=20SET=20TABLESPACE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was being treated as any other configuration parameter. --- src/bin/psql/tab-complete.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index bb696f8ee9..f107ffb027 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -1783,6 +1783,10 @@ psql_completion(const char *text, int start, int end) "IS_TEMPLATE", "ALLOW_CONNECTIONS", "CONNECTION LIMIT"); + /* ALTER DATABASE SET TABLESPACE */ + else if (Matches5("ALTER", "DATABASE", MatchAny, "SET", "TABLESPACE")) + COMPLETE_WITH_QUERY(Query_for_list_of_tablespaces); + /* ALTER EVENT TRIGGER */ else if (Matches3("ALTER", "EVENT", "TRIGGER")) COMPLETE_WITH_QUERY(Query_for_list_of_event_triggers); -- 2.18.0 --=-=-=--