Tab complete for CREATE SUBSCRIPTION ... CONECTION does not work
Hi hacker,
As $subject detailed, the tab-complete cannot work such as:
CREATE SUBSCRIPTION sub CONNECTION 'dbname=postgres port=6543' \t
It seems that the get_previous_words() could not parse the single quote.
OTOH, it works for CREATE SUBSCRIPTION sub CONNECTION xx \t, should we fix it?
--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.
On Tue, 20 Sep 2022 at 00:19, Japin Li <japinli@hotmail.com> wrote:
Hi hacker,
As $subject detailed, the tab-complete cannot work such as:
CREATE SUBSCRIPTION sub CONNECTION 'dbname=postgres port=6543' \t
It seems that the get_previous_words() could not parse the single quote.
OTOH, it works for CREATE SUBSCRIPTION sub CONNECTION xx \t, should we fix it?
Attach fixed this problem. Any thoughts?
--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.
Attachments:
v1-0001-Fix-tab-completation-for-CREATE-SUBSCRIPTION.patchtext/x-patchDownload
From 40b3ef8decd305bdaefddd797872da05bb5b65b4 Mon Sep 17 00:00:00 2001
From: Japin Li <japinli@hotmail.com>
Date: Thu, 22 Sep 2022 22:39:00 +0800
Subject: [PATCH v1] Fix tab-completation for CREATE SUBSCRIPTION
---
src/bin/psql/tab-complete.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 820f47d23a..73c34aed83 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -6068,7 +6068,7 @@ get_previous_words(int point, char **buffer, int *nwords)
*/
for (start = end; start > 0; start--)
{
- if (buf[start] == '"')
+ if (buf[start] == '"' || buf[start] == '\'')
inquotes = !inquotes;
if (!inquotes)
{
--
2.25.1
On Tue, Dec 26, 2023 at 3:02 PM Japin Li <japinli@hotmail.com> wrote:
Hi hacker,
As $subject detailed, the tab-complete cannot work such as:
CREATE SUBSCRIPTION sub CONNECTION 'dbname=postgres port=6543' \t
It seems that the get_previous_words() could not parse the single quote.
OTOH, it works for CREATE SUBSCRIPTION sub CONNECTION xx \t, should we fix it?
I reviewed the Patch and it looks fine to me.
Thanks and Regards,
Shubham Khanna.
On Tue, 26 Dec 2023 at 18:10, Shubham Khanna <khannashubham1197@gmail.com> wrote:
On Tue, Dec 26, 2023 at 3:02 PM Japin Li <japinli@hotmail.com> wrote:
Hi hacker,
As $subject detailed, the tab-complete cannot work such as:
CREATE SUBSCRIPTION sub CONNECTION 'dbname=postgres port=6543' \t
It seems that the get_previous_words() could not parse the single quote.
OTOH, it works for CREATE SUBSCRIPTION sub CONNECTION xx \t, should we fix it?
I reviewed the Patch and it looks fine to me.
Thanks for the review.
--
Regrads,
Japin Li
ChengDu WenWu Information Technology Co., Ltd.