Re: proposal \gcsv - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: proposal \gcsv
Date
Msg-id CAFj8pRDW2Cv6ZXCnRmRsJ_Kof4XVC2+pLJPv5sttfF1m5K8++g@mail.gmail.com
Whole thread Raw
In response to Re: proposal \gcsv  (Vik Fearing <vik@postgresfriends.org>)
Responses Re: proposal \gcsv  (Vik Fearing <vik@postgresfriends.org>)
Re: proposal \gcsv  (Erik Rijkers <er@xs4all.nl>)
List pgsql-hackers
Hi

čt 26. 3. 2020 v 17:45 odesílatel Vik Fearing <vik@postgresfriends.org> napsal:
On 3/24/20 3:02 AM, Pavel Stehule wrote:
> Hi
>
> rebase

Thank you, Pavel.

I have now had time to review it, and it looks good to me except for two
issues.

The first is, even though I suggested gf, I think it should actually be
gfmt.  There may be something else in the future that starts with f and
we shouldn't close ourselves off to it.

renamed to \gfmt


The second is tab completion doesn't work for the second argument.
Adding the following fixes that:

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index ed6945a7f12..9d8cf442972 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -3786,6 +3786,12 @@ psql_completion(const char *text, int start, int end)
                COMPLETE_WITH_CS("aligned", "asciidoc", "csv", "html",
"latex",
                                                 "latex-longtable",
"troff-ms", "unaligned",
                                                 "wrapped");
+       else if (TailMatchesCS("\\gf", MatchAny))
+       {
+               completion_charp = "\\";
+               completion_force_quote = false;
+               matches = rl_completion_matches(text, complete_from_files);
+       }

        else if (TailMatchesCS("\\h|\\help"))
                COMPLETE_WITH_LIST(sql_commands);


merged


After some opinions on the first issue and fixing the second, I think
this is good to be committed.

Thank you for review

Pavel

--
Vik Fearing
Attachment

pgsql-hackers by date:

Previous
From: John Naylor
Date:
Subject: Re: Unicode normalization SQL functions
Next
From: Vik Fearing
Date:
Subject: Re: proposal \gcsv