pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed[PATCH] Feature improvement for TRUNCATE tab completion.
4+ messages / 3 participants
[nested] [flat]
Commits from this thread:
2021-02-25 6b40d9bdbd Improve tab-completion for TRUNCATE.
* [PATCH] Feature improvement for TRUNCATE tab completion.
@ 2021-02-22 07:04 miyake_kouta <miyake_kouta@oss.nttdata.com>
0 siblings, 1 reply; 4+ messages in thread
From: miyake_kouta @ 2021-02-22 07:04 UTC (permalink / raw)
To: pgsql-hackers
Hi.
I created a patch which improves psql's TRUNCATE tab completion.
Current tab completion can complement only a table name to be truncated.
This patch enables psql to complement other keywords related to
TRUNCATE.
Regards.
Kota Miyake
Attachments:
truncate_tab_completion.patch (text/x-diff, 1.0K) download
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 1e1c315bae..ef9ef4cb25 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -3799,7 +3799,20 @@ psql_completion(const char *text, int start, int end)
/* TRUNCATE */
else if (Matches("TRUNCATE"))
+ COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables,
+ " UNION SELECT 'TABLE'"
+ " UNION SELECT 'ONLY'");
+ else if (Matches("TRUNCATE", "TABLE"))
+ COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables,
+ " UNION SELECT 'ONLY'");
+ else if (HeadMatches("TRUNCATE") && TailMatches("ONLY"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);
+ else if (Matches("TRUNCATE", MatchAny) ||
+ Matches("TRUNCATE", "TABLE|ONLY", MatchAny) ||
+ Matches("TRUNCATE", "TABLE", "ONLY", MatchAny))
+ COMPLETE_WITH("RESTART IDENTITY", "CONTINUE IDENTITY", "CASCADE", "RESTRICT");
+ else if (HeadMatches("TRUNCATE") && TailMatches("IDENTITY"))
+ COMPLETE_WITH("CASCADE", "RESTRICT");
/* UNLISTEN */
else if (Matches("UNLISTEN"))
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [PATCH] Feature improvement for TRUNCATE tab completion.
@ 2021-02-22 16:44 Muhammad Usama <m.usama@gmail.com>
parent: miyake_kouta <miyake_kouta@oss.nttdata.com>
0 siblings, 1 reply; 4+ messages in thread
From: Muhammad Usama @ 2021-02-22 16:44 UTC (permalink / raw)
To: pgsql-hackers@lists.postgresql.org; +Cc: Kota Miyake <miyake_kouta@oss.nttdata.com>
The following review has been posted through the commitfest application:
make installcheck-world: not tested
Implements feature: tested, passed
Spec compliant: tested, passed
Documentation: not tested
Other than "Hunk #1 succeeded at 3832 (offset 33 lines)." message while applying the patch to
current master branch (commit 6a03369a71d4a7dc5b8d928aab775ddd28b72494) I found no issue with the patch.
The new status of this patch is: Ready for Committer
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [PATCH] Feature improvement for TRUNCATE tab completion.
@ 2021-02-24 03:59 Fujii Masao <masao.fujii@oss.nttdata.com>
parent: Muhammad Usama <m.usama@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Fujii Masao @ 2021-02-24 03:59 UTC (permalink / raw)
To: Muhammad Usama <m.usama@gmail.com>; pgsql-hackers@lists.postgresql.org; +Cc: Kota Miyake <miyake_kouta@oss.nttdata.com>
On 2021/02/23 1:44, Muhammad Usama wrote:
> The following review has been posted through the commitfest application:
> make installcheck-world: not tested
> Implements feature: tested, passed
> Spec compliant: tested, passed
> Documentation: not tested
>
> Other than "Hunk #1 succeeded at 3832 (offset 33 lines)." message while applying the patch to
> current master branch (commit 6a03369a71d4a7dc5b8d928aab775ddd28b72494) I found no issue with the patch.
>
> The new status of this patch is: Ready for Committer
OK, so barring any objection, I will commit this patch.
Regards,
--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [PATCH] Feature improvement for TRUNCATE tab completion.
@ 2021-02-25 09:22 Fujii Masao <masao.fujii@oss.nttdata.com>
parent: Fujii Masao <masao.fujii@oss.nttdata.com>
0 siblings, 0 replies; 4+ messages in thread
From: Fujii Masao @ 2021-02-25 09:22 UTC (permalink / raw)
To: Muhammad Usama <m.usama@gmail.com>; pgsql-hackers@lists.postgresql.org; +Cc: Kota Miyake <miyake_kouta@oss.nttdata.com>
On 2021/02/24 12:59, Fujii Masao wrote:
>
>
> On 2021/02/23 1:44, Muhammad Usama wrote:
>> The following review has been posted through the commitfest application:
>> make installcheck-world: not tested
>> Implements feature: tested, passed
>> Spec compliant: tested, passed
>> Documentation: not tested
>>
>> Other than "Hunk #1 succeeded at 3832 (offset 33 lines)." message while applying the patch to
>> current master branch (commit 6a03369a71d4a7dc5b8d928aab775ddd28b72494) I found no issue with the patch.
>>
>> The new status of this patch is: Ready for Committer
>
> OK, so barring any objection, I will commit this patch.
Pushed. Thanks!
Regards,
--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2021-02-25 09:22 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-02-22 07:04 [PATCH] Feature improvement for TRUNCATE tab completion. miyake_kouta <miyake_kouta@oss.nttdata.com>
2021-02-22 16:44 ` Muhammad Usama <m.usama@gmail.com>
2021-02-24 03:59 ` Fujii Masao <masao.fujii@oss.nttdata.com>
2021-02-25 09:22 ` Fujii Masao <masao.fujii@oss.nttdata.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox