Re: Tab completion for CREATE TYPE

Lists: pgsql-hackers
From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Tab completion for CREATE TYPE
Date: 2019-05-14 05:50:58
Message-ID: CA+hUKGLk=0yLDjfviONJLzcHEzygj=x6VbGH43LnXbBUvQb52g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

Since I keep forgetting the syntax and options, here is $SUBJECT.

--
Thomas Munro
https://enterprisedb.com

Attachment Content-Type Size
0001-Tab-completion-for-CREATE-TYPE.patch application/octet-stream 2.2 KB

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: thomas(dot)munro(at)gmail(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Tab completion for CREATE TYPE
Date: 2019-05-14 06:18:07
Message-ID: 20190514.151807.36347798.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hello.

At Tue, 14 May 2019 17:50:58 +1200, Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote in <CA+hUKGLk=0yLDjfviONJLzcHEzygj=x6VbGH43LnXbBUvQb52g(at)mail(dot)gmail(dot)com>
> Hi,
>
> Since I keep forgetting the syntax and options, here is $SUBJECT.

I played with this a bit and found that "... (attr=[tab]" (no
space between "r" and "=") complets with '='. Isn't it annoying?

Only "UPDATE hoge SET a=[tab]" behaves the same way among
existing completions.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center


From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Tab completion for CREATE TYPE
Date: 2019-05-14 06:58:14
Message-ID: CA+hUKG+ojKTKw=aG6QU=VmPMc8Sq7nM4Ah7fk1e+g1YngCVNmg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, May 14, 2019 at 6:18 PM Kyotaro HORIGUCHI
<horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> I played with this a bit and found that "... (attr=[tab]" (no
> space between "r" and "=") complets with '='. Isn't it annoying?
>
> Only "UPDATE hoge SET a=[tab]" behaves the same way among
> existing completions.

Hmm. True. Here's one way to fix that.

--
Thomas Munro
https://enterprisedb.com

Attachment Content-Type Size
0001-Tab-completion-for-CREATE-TYPE-v2.patch application/octet-stream 2.2 KB
0002-Fix-tab-completion-of-UPDATE-v2.patch application/octet-stream 846 bytes

From: Edgy Hacker <edgy(dot)hacker(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Tab completion for CREATE TYPE
Date: 2019-05-14 08:31:17
Message-ID: 20190514083117.GA12568@metal
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, May 14, 2019 at 06:58:14PM +1200, Thomas Munro wrote:
> On Tue, May 14, 2019 at 6:18 PM Kyotaro HORIGUCHI
> <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> > I played with this a bit and found that "... (attr=[tab]" (no
> > space between "r" and "=") complets with '='. Isn't it annoying?
> >
> > Only "UPDATE hoge SET a=[tab]" behaves the same way among
> > existing completions.
>
> Hmm. True. Here's one way to fix that.

Hmm... just got here.

What happens around here?

>
> --
> Thomas Munro
> https://enterprisedb.com


From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Edgy Hacker <edgy(dot)hacker(at)gmail(dot)com>
Cc: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Tab completion for CREATE TYPE
Date: 2019-05-14 09:01:27
Message-ID: CA+hUKGKMWOnUx+bEnYEe72nTvDxqxy0mToRvu6R0X3TV1ebrBw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, May 14, 2019 at 8:32 PM Edgy Hacker <edgy(dot)hacker(at)gmail(dot)com> wrote:
> Hmm... just got here.

Welcome.

> What happens around here?

Please see https://wiki.postgresql.org/wiki/So,_you_want_to_be_a_developer%3F .

--
Thomas Munro
https://enterprisedb.com


From: Edgy Hacker <edgy(dot)hacker(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp
Subject: Re: Tab completion for CREATE TYPE
Date: 2019-05-14 09:25:21
Message-ID: 20190514092521.GA13464@metal
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, May 14, 2019 at 09:01:27PM +1200, Thomas Munro wrote:
> On Tue, May 14, 2019 at 8:32 PM Edgy Hacker <edgy(dot)hacker(at)gmail(dot)com> wrote:
> > Hmm... just got here.
>
> Welcome.

Thanks.

>
> > What happens around here?
>
> Please see https://wiki.postgresql.org/wiki/So,_you_want_to_be_a_developer%3F .

Not exactly a prospective developer but if it ever comes it...

>
> --
> Thomas Munro
> https://enterprisedb.com


From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: thomas(dot)munro(at)gmail(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Tab completion for CREATE TYPE
Date: 2019-05-14 11:13:24
Message-ID: 20190514.201324.19005271.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

At Tue, 14 May 2019 18:58:14 +1200, Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote in <CA+hUKG+ojKTKw=aG6QU=VmPMc8Sq7nM4Ah7fk1e+g1YngCVNmg(at)mail(dot)gmail(dot)com>
> On Tue, May 14, 2019 at 6:18 PM Kyotaro HORIGUCHI
> <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> > I played with this a bit and found that "... (attr=[tab]" (no
> > space between "r" and "=") complets with '='. Isn't it annoying?
> >
> > Only "UPDATE hoge SET a=[tab]" behaves the same way among
> > existing completions.
>
> Hmm. True. Here's one way to fix that.

Thanks. That's what was in my mind.

Some definition item names are induced from some current states
(e.g. "CREATE TYPE name AS RANGE (" => "SUBTYPE = ") but I think
it's too much.

COLLATE is not suggested with possible collations but I think
suggesting it is not so useful.

PASSEDBYVALUE is suggested with '=', which is different from
documented syntax but I don't think that's not such a problem for
those who spell this command out.

# By the way, collatable and preferred are boolean which behaves
# the same way with passedbyvalue. Is there any intention in the
# difference in the documentation?

The completion lists contain all possible words correctly (I
think "analyse" is an implicit synonym.).

As the result, I find it perfect.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center


From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Tab completion for CREATE TYPE
Date: 2019-07-13 04:54:06
Message-ID: CA+hUKGJz-pdMgWXroiwvN-aeG4-AjdWj3gWdQKOSa8g65spdVw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, May 14, 2019 at 11:13 PM Kyotaro HORIGUCHI
<horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> At Tue, 14 May 2019 18:58:14 +1200, Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote in <CA+hUKG+ojKTKw=aG6QU=VmPMc8Sq7nM4Ah7fk1e+g1YngCVNmg(at)mail(dot)gmail(dot)com>
> > On Tue, May 14, 2019 at 6:18 PM Kyotaro HORIGUCHI
> > <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> > > I played with this a bit and found that "... (attr=[tab]" (no
> > > space between "r" and "=") complets with '='. Isn't it annoying?
> > >
> > > Only "UPDATE hoge SET a=[tab]" behaves the same way among
> > > existing completions.
> >
> > Hmm. True. Here's one way to fix that.
>
> Thanks. That's what was in my mind.

I pushed a fix for that separately. I remembered that we had decided
to use MatchAnyExcept("...") instead of "!...", so I did it that way.

> Some definition item names are induced from some current states
> (e.g. "CREATE TYPE name AS RANGE (" => "SUBTYPE = ") but I think
> it's too much.
>
> COLLATE is not suggested with possible collations but I think
> suggesting it is not so useful.

Yes, there is room to make it smarter.

> PASSEDBYVALUE is suggested with '=', which is different from
> documented syntax but I don't think that's not such a problem for
> those who spell this command out.
>
> # By the way, collatable and preferred are boolean which behaves
> # the same way with passedbyvalue. Is there any intention in the
> # difference in the documentation?

Good question.

> The completion lists contain all possible words correctly (I
> think "analyse" is an implicit synonym.).

I am not a fan of doing anything at all to support alternative
spellings for keywords etc, even though I personally use British
spelling in most contexts outside PostgreSQL source code. We don't
support MATERIALISED, CATALOGUE, BACKWARDS/FORWARDS (with an S), etc,
so I don't know why we have this one single word ANALYSE from a
different spelling system than the one used by SQL.

> As the result, I find it perfect.

Pushed. Thanks for the review!

--
Thomas Munro
https://enterprisedb.com