Re: IF (NOT) EXISTS in psql-completion

From: David Steele <david(at)pgmasters(dot)net>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: sfrost(at)snowman(dot)net, david(at)fetter(dot)org, michael(dot)paquier(at)gmail(dot)com, tgl(at)sss(dot)pgh(dot)pa(dot)us, robertmhaas(at)gmail(dot)com, pavel(dot)stehule(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: IF (NOT) EXISTS in psql-completion
Date: 2017-03-13 14:42:05
Message-ID: 1e8297fd-f7f2-feab-848d-5121e45c8cba@pgmasters.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

On 3/1/17 9:38 PM, Kyotaro HORIGUCHI wrote:

> At Tue, 28 Feb 2017 10:39:01 -0500, Stephen Frost <sfrost(at)snowman(dot)net> wrote in <20170228153901(dot)GH9812(at)tamriel(dot)snowman(dot)net>
>> * David Fetter (david(at)fetter(dot)org) wrote:
>>> On Mon, Feb 27, 2017 at 11:53:17PM -0500, Stephen Frost wrote:
>>>> * Kyotaro HORIGUCHI (horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp) wrote:
>>>>> I suppose it is for suggesting what kind of word should come
>>>>> there, or avoiding silence for a tab. Or for symmetry with other
>>>>> types of manipulation, like DROP. Another possibility is creating
>>>>> multiple objects with similar names, say CREATE TABLE employee_x1,
>>>>> CREATE TABLE employee_x2. Just trying to complete existing
>>>>> *schema* is one more another possible objective.
>>>>
>>>> I don't buy any of these arguments either. I *really* don't want us
>>>> going down some road where we try to make sure that hitting 'tab'
>>>> never fails...
>
> These suggestions exist before this patch. Whether to remove them
> would be another discussion. I was going to add some but finally
> I believe I have added no such things in this patchset.
>
>>> Wouldn't that just be a correct, grammar-aware implementation of tab
>>> completion? Why wouldn't you want that?
>>
>> No, it wouldn't, it would mean we have to provide something for cases
>> where it doesn't make sense to try and provide an answer, as being
>> discussed here for CREATE TABLE.
>>
>> We can't provide an answer based on tab-completion to what you want to
>> call your new table.
>
> The difference seems to be that what we take this feature to
> be. If we see it as just a fast-path of entering a word where we
> know what words should come, silence is not a problem. If we see
> it as safety-wheels to guide users to the right way to go,
> silence would be bad. A silence during word completion suggests
> something wrong in the preceding words to me so it is a bit
> annoying.
>
> As an analogous operation, mkdir on bash suggests existing
> directories. We can suggest existing tables for CREATE TABLE with
> the same basis.
>
> Another possible way to go would be showing a 'suggestion' not a
> list of possibilities. If readline allows such operation, I
> imagine the following. But this is a quite diferrent discussion.
>
> =# CREATE TABLE <tab>
> <<a table name to create>>
> =# CREATE TABLE table1 <tab>
>
> regards,

It has been a while since this thread has received any comments or a new
patch. The general consensus seems to be that this feature is too large
a rewrite of tab completion considering a major rewrite was done for 9.6.

Are you considering writing a localized patch for this feature as Tom
suggested? If so, please post that by 2017-03-16 AoE.

If no new patch is submitted by that date I will mark this submission
"Returned with Feedback".

Thanks,
--
-David
david(at)pgmasters(dot)net

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Steele 2017-03-13 14:56:31 Re: \h tab-completion
Previous Message Ashutosh Sharma 2017-03-13 14:36:25 Re: WAL Consistency checking for hash indexes