Re: [HACKERS] COPY (... tab completion

2016-01-20 Thread Peter Eisentraut
On 1/19/16 6:00 AM, Andreas Karlsson wrote: > On 01/19/2016 07:55 AM, Michael Paquier wrote: >> +/* If we have COPY BINARY, compelete with list of tables */ >> s/compelete/complete > > Fixed. > >> +else if (TailMatches2("COPY|\\copy", "(")) >> +COMPLETE_WITH_LIST7("SELECT",

Re: [HACKERS] COPY (... tab completion

2016-01-19 Thread Andreas Karlsson
On 01/19/2016 07:55 AM, Michael Paquier wrote: +/* If we have COPY BINARY, compelete with list of tables */ s/compelete/complete Fixed. +else if (TailMatches2("COPY|\\copy", "(")) +COMPLETE_WITH_LIST7("SELECT", "TABLE", "VALUES", "INSERT", "UPDATE", "DELETE", "WITH"); This

Re: [HACKERS] COPY (... tab completion

2016-01-19 Thread Michael Paquier
On Tue, Jan 19, 2016 at 8:00 PM, Andreas Karlsson wrote: > On 01/19/2016 07:55 AM, Michael Paquier wrote: >> >> +/* If we have COPY BINARY, compelete with list of tables */ >> s/compelete/complete > > Fixed. > >> +else if (TailMatches2("COPY|\\copy", "(")) >> +

Re: [HACKERS] COPY (... tab completion

2016-01-19 Thread Tom Lane
Michael Paquier writes: > This patch makes me wonder: are we going to nuke the grammar "COPY [ > BINARY ] table_name" at some point? This was used up to 7.3. I'm not particularly in a hurry to remove obsolete syntaxes, as long as they're not blocking forward progress

Re: [HACKERS] COPY (... tab completion

2016-01-18 Thread Andreas Karlsson
On 01/11/2016 02:01 AM, Peter Eisentraut wrote: I think this would be a useful addition. A couple of problems: Thanks for the review. A new version is attached. This change in the comment doesn't make sense to me and doesn't seem to match the code: - /* If we have COPY [BINARY] ,

Re: [HACKERS] COPY (... tab completion

2016-01-18 Thread Andreas Karlsson
On 01/19/2016 01:57 AM, Andreas Karlsson wrote: Thanks for the review. A new version is attached. Whops, attached the wrong file. Andreas diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index ad8a580..bc80ed0 100644 --- a/src/bin/psql/tab-complete.c +++

Re: [HACKERS] COPY (... tab completion

2016-01-18 Thread Michael Paquier
On Tue, Jan 19, 2016 at 10:12 AM, Andreas Karlsson wrote: > On 01/19/2016 01:57 AM, Andreas Karlsson wrote: >> >> Thanks for the review. A new version is attached. > > > Whops, attached the wrong file. +/* If we have COPY BINARY, compelete with list of tables */

Re: [HACKERS] COPY (... tab completion

2016-01-10 Thread Peter Eisentraut
I think this would be a useful addition. A couple of problems: This change in the comment doesn't make sense to me and doesn't seem to match the code: - /* If we have COPY [BINARY] , complete it with "TO" or "FROM" */ + /* If we have COPY|BINARY , complete it with "TO" or "FROM" */

Re: [HACKERS] COPY (... tab completion

2016-01-10 Thread Tom Lane
Peter Eisentraut writes: > I think this would be a useful addition. A couple of problems: > This change in the comment doesn't make sense to me and doesn't seem to > match the code: > - /* If we have COPY [BINARY] , complete it with "TO" or "FROM" */ > + /* If we have

Re: [HACKERS] COPY (... tab completion

2016-01-10 Thread Peter Eisentraut
On 1/10/16 8:01 PM, Peter Eisentraut wrote: > The list of commands to allow as the "query" inside the parentheses is > documented to be: SELECT, VALUES, INSERT, UPDATE or DELETE; and actually > TABLE should also work. Your list doesn't include all of those. To be fair, this is actually a recent

Re: [HACKERS] COPY (... tab completion

2016-01-06 Thread Andreas Karlsson
Hi, I have an updated patch which uses Matches() rather than TailMatches(). Andreas diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index b5117d4..158b913 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -1934,12 +1934,19 @@

[HACKERS] COPY (... tab completion

2015-12-29 Thread Andreas Karlsson
Hi, Here is a patch which adds tab completion for COPY with a query. Currently there is only completion for COPY with a relation. Andreas diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 98884eb..98023ca 100644 --- a/src/bin/psql/tab-complete.c +++