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 1fvQDH-00083Y-Sj for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Aug 2018 16:54:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fvQDG-0004yR-An for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Aug 2018 16:54:30 +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 1fvQDF-0004yK-Vq for pgsql-hackers@lists.postgresql.org; Thu, 30 Aug 2018 16:54:30 +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 1fvQDD-0000Ji-BP for pgsql-hackers@postgresql.org; Thu, 30 Aug 2018 16:54:28 +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 1fvQD9-0000BL-JA for ; Thu, 30 Aug 2018 18:54:25 +0200 Received: from ilmari by dalvik.ping.uio.no with local (Exim 4.84_2) (envelope-from ) id 1fvQD9-00077d-CT for pgsql-hackers@postgresql.org; Thu, 30 Aug 2018 18:54:23 +0200 From: ilmari@ilmari.org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=) To: pgsql-hackers@postgresql.org Subject: Re: [PATCH] Tab completion for ALTER DATABASE =?utf-8?Q?=E2=80=A6?= SET TABLESPACE References: Mail-Copies-To: nobody Date: Thu, 30 Aug 2018 17:54:23 +0100 In-Reply-To: ("Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker=22's?= message of "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 ilmari@ilmari.org (Dagfinn Ilmari Mannsåker) writes: > 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. And just after hitting send, I noticed I'd typed ALTER TABLE instead of ALTER DATABASE, including in the commit message :( Fixed patch attached. - ilmari -- "I use RMS as a guide in the same way that a boat captain would use a lighthouse. It's good to know where it is, but you generally don't want to find yourself in the same spot." - Tollef Fog Heen --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Fix-tab-completion-for-ALTER-DATABASE-SET-TABLESPACE.patch From e5ff67c3284dd456fe80ed8a8927e12665d68fea 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=20DATABASE?= =?UTF-8?q?=20=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 --=-=-=--