Re: psql tab completion bug for ALL IN TABLESPACE - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: psql tab completion bug for ALL IN TABLESPACE
Date
Msg-id CAB7nPqTdvnMFgMmNSuX7iKQ16URRDE=aK05sLqJMfEK9vJun-w@mail.gmail.com
Whole thread Raw
In response to Re: psql tab completion bug for ALL IN TABLESPACE  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On Mon, Dec 14, 2015 at 8:18 PM, Andres Freund <andres@anarazel.de> wrote:
> On 2015-12-12 21:04:31 +0900, Michael Paquier wrote:
>> Hi all,
>>
>> I just bumped into the following thing while looking again at Thomas'
>> patch for psql tab completion:
>> --- a/src/bin/psql/tab-complete.c
>> +++ b/src/bin/psql/tab-complete.c
>> @@ -1040,7 +1040,7 @@ psql_completion(const char *text, int start, int end)
>>                          pg_strcasecmp(prev5_wd, "IN") == 0 &&
>>                          pg_strcasecmp(prev4_wd, "TABLESPACE") == 0 &&
>>                          pg_strcasecmp(prev2_wd, "OWNED") == 0 &&
>> -                        pg_strcasecmp(prev4_wd, "BY") == 0)
>> +                        pg_strcasecmp(prev_wd, "BY") == 0)
>>         {
>>                 COMPLETE_WITH_QUERY(Query_for_list_of_roles);
>> This should be backpatched, attached is the needed patch.
>
> Hm, this seems to need slightly more expansive surgery.
>
> Trivially the comments for ALL IN TABLESPACE seem broken/badly copy pasted:
>          /* ALTER TABLE,INDEX,MATERIALIZED VIEW xxx ALL IN TABLESPACE xxx */
> the first xxx doesnt make sense.

Indeed.

> Secondly the OWNED BY completion then breaks the SET TABLESPACE
> completion. That's maybe not an outright bug, but seems odd nonetheless.

You mean that this code should do the completion of SET TABLESPACE
after "OWNED BY xxx" has been typed? Are you sure it's worth going
this far?
-- 
Michael



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: psql tab completion bug for ALL IN TABLESPACE
Next
From: Andres Freund
Date:
Subject: Re: psql tab completion bug for ALL IN TABLESPACE