Feature improvement of tab completion for DEALLOCATE

Started by btnakamichinover 5 years ago4 messages
#1btnakamichin
btnakamichin@oss.nttdata.com
1 attachment(s)

Hello!

I’d like to improve the deallocate tab completion.

The deallocate tab completion can’t complement “ALL”. Therefore, this
patch fixes the problem.

Regards,

Naoki Nakamichi

Attachments:

fix_tab_complete_deallocate.patchtext/x-diff; name=fix_tab_complete_deallocate.patchDownload
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 9c6f5ecb6a..d877cc86f0 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2911,7 +2911,7 @@ psql_completion(const char *text, int start, int end)
 
 /* DEALLOCATE */
 	else if (Matches("DEALLOCATE"))
-		COMPLETE_WITH_QUERY(Query_for_list_of_prepared_statements);
+		COMPLETE_WITH_QUERY(Query_for_list_of_prepared_statements " UNION SELECT 'ALL'");
 
 /* DECLARE */
 	else if (Matches("DECLARE", MatchAny))
#2Fujii Masao
masao.fujii@oss.nttdata.com
In reply to: btnakamichin (#1)
Re: Feature improvement of tab completion for DEALLOCATE

On 2020/09/25 13:45, btnakamichin wrote:

Hello!

I’d like to improve the deallocate tab completion.

The deallocate tab completion can’t complement “ALL”. Therefore, this patch fixes the problem.

Thanks for the patch! It looks basically good, but I think it's better
to add newline just before UNION to avoid long line, as follows.

-               COMPLETE_WITH_QUERY(Query_for_list_of_prepared_statements);
+               COMPLETE_WITH_QUERY(Query_for_list_of_prepared_statements
+                                                       " UNION SELECT 'ALL'");

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

#3btnakamichin
btnakamichin@oss.nttdata.com
In reply to: Fujii Masao (#2)
1 attachment(s)
Re: Feature improvement of tab completion for DEALLOCATE

2020-09-25 14:30 に Fujii Masao さんは書きました:

On 2020/09/25 13:45, btnakamichin wrote:

Hello!

I’d like to improve the deallocate tab completion.

The deallocate tab completion can’t complement “ALL”. Therefore, this
patch fixes the problem.

Thanks for the patch! It looks basically good, but I think it's better
to add newline just before UNION to avoid long line, as follows.

-               
COMPLETE_WITH_QUERY(Query_for_list_of_prepared_statements);
+               
COMPLETE_WITH_QUERY(Query_for_list_of_prepared_statements
+                                                       " UNION SELECT 
'ALL'");

Regards,

Thank you, I appreciate your comment.

I have attached pattch with newline.

Regards,

NaokiNskamichi

Attachments:

fix_tab_complete_deallocate_v2.patchtext/x-diff; name=fix_tab_complete_deallocate_v2.patchDownload
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index d877cc86f0..75f81d66dc 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2911,7 +2911,8 @@ psql_completion(const char *text, int start, int end)
 
 /* DEALLOCATE */
 	else if (Matches("DEALLOCATE"))
-		COMPLETE_WITH_QUERY(Query_for_list_of_prepared_statements " UNION SELECT 'ALL'");
+		COMPLETE_WITH_QUERY(Query_for_list_of_prepared_statements 
+		                    " UNION SELECT 'ALL'");
 
 /* DECLARE */
 	else if (Matches("DECLARE", MatchAny))
#4Fujii Masao
masao.fujii@oss.nttdata.com
In reply to: btnakamichin (#3)
Re: Feature improvement of tab completion for DEALLOCATE

On 2020/09/25 15:18, btnakamichin wrote:

2020-09-25 14:30 に Fujii Masao さんは書きました:

On 2020/09/25 13:45, btnakamichin wrote:

Hello!

I’d like to improve the deallocate tab completion.

The deallocate tab completion can’t complement “ALL”. Therefore, this patch fixes the problem.

Thanks for the patch! It looks basically good, but I think it's better
to add newline just before UNION to avoid long line, as follows.

- COMPLETE_WITH_QUERY(Query_for_list_of_prepared_statements);
+ COMPLETE_WITH_QUERY(Query_for_list_of_prepared_statements
+                                                       " UNION SELECT 'ALL'");

Regards,

Thank you, I appreciate your comment.

I have attached pattch with newline.

Thanks for updating the patch! But it contains only the diff from the previous patch.
Anyway, I pushed the change that you proposed. Thanks!

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION