Re: psql: tab completions for 'WITH'

Lists: pgsql-hackers
From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: psql: tab completions for 'WITH'
Date: 2012-04-04 05:34:13
Message-ID: CAK3UJREwvjYd3=6_xTm3H7H96an24iBp=bCPpaz5W8pdbSgYzQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi all,

I noticed psql's tab-completion for 'WITH' is a bit overeager. If you
try to tab-complete commands like:
ALTER ROLE jsmith WITH [TAB]
COPY tbl FROM 'filename' WITH [TAB]

you'll get 'RECURSIVE' unhelpfully filled in. I think 'RECURSIVE'
should only be suggested if 'WITH' is the first and only word of the
line.

On a related note, I found it annoying that after fixing the above
problem, trying:
ALTER ROLE jsmith WITH [TAB]
CREATE ROLE jsmith WITH [TAB]

didn't suggest any tab-completions -- it only works if you leave off
the 'WITH' noise word, which I happen to use.

Attached are fixes for both of these gripes. I'll add to the next CF.

Josh

Attachment Content-Type Size
overeager_with.diff application/octet-stream 914 bytes
create_alter_role_tab_complete.diff application/octet-stream 3.7 KB

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql: tab completions for 'WITH'
Date: 2012-04-10 17:38:36
Message-ID: 1334079516.1383.1.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On tis, 2012-04-03 at 22:34 -0700, Josh Kupershmidt wrote:
> I noticed psql's tab-completion for 'WITH' is a bit overeager. If you
> try to tab-complete commands like:
> ALTER ROLE jsmith WITH [TAB]
> COPY tbl FROM 'filename' WITH [TAB]
>
> you'll get 'RECURSIVE' unhelpfully filled in. I think 'RECURSIVE'
> should only be suggested if 'WITH' is the first and only word of the
> line.

Committed that.

> On a related note, I found it annoying that after fixing the above
> problem, trying:
> ALTER ROLE jsmith WITH [TAB]
> CREATE ROLE jsmith WITH [TAB]
>
> didn't suggest any tab-completions -- it only works if you leave off
> the 'WITH' noise word, which I happen to use.

Hmm, but now you've set it up so that you can complete ALTER ROLE foo
WITH WITH. Were you aware of that?


From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql: tab completions for 'WITH'
Date: 2012-04-11 00:48:25
Message-ID: CAK3UJRH8wr920zH3pL6w-TSN7K8aah1oDF7=cmvyx06sUBdn9A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Apr 10, 2012 at 10:38 AM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> On tis, 2012-04-03 at 22:34 -0700, Josh Kupershmidt wrote:
>> I noticed psql's tab-completion for 'WITH' is a bit overeager. If you
>> try to tab-complete commands like:
>>   ALTER ROLE jsmith WITH [TAB]
>>   COPY tbl FROM 'filename' WITH [TAB]
>>
>> you'll get 'RECURSIVE' unhelpfully filled in. I think 'RECURSIVE'
>> should only be suggested if 'WITH' is the first and only word of the
>> line.
>
> Committed that.

Thanks!

>> On a related note, I found it annoying that after fixing the above
>> problem, trying:
>>     ALTER ROLE jsmith WITH [TAB]
>>     CREATE ROLE jsmith WITH [TAB]
>>
>> didn't suggest any tab-completions -- it only works if you leave off
>> the 'WITH' noise word, which I happen to use.
>
> Hmm, but now you've set it up so that you can complete ALTER ROLE foo
> WITH WITH.  Were you aware of that?

D'oh, I overlooked that. Attached is v2: the diff is a tad lengthier
now, but that should fix it.

Josh

Attachment Content-Type Size
create_alter_role_tab_complete.v2.diff application/octet-stream 4.3 KB

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql: tab completions for 'WITH'
Date: 2012-04-18 13:56:49
Message-ID: 1334757409.29544.6.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On tis, 2012-04-10 at 17:48 -0700, Josh Kupershmidt wrote:
> > Hmm, but now you've set it up so that you can complete ALTER ROLE
> foo
> > WITH WITH. Were you aware of that?
>
> D'oh, I overlooked that. Attached is v2: the diff is a tad lengthier
> now, but that should fix it.

Committed.