Thread: Add a tab-completion for "SELECT INTO" or "SELECT FROM"in psql
Hi,
I use tab-completion in psql quite often and I find that I can't complete "FROM" for SELECT query.
So I try to create a patch for it.
I download the source code from GitHub master branch and modify the file to create the patch.
I compile the code and my code change works like follows,
--------------------------------------------------------------
postgres=# SELECT * <Tab Key><Tab Key>
FROM INTO
postgres=# SELECT *
--------------------------------------------------------------
This is my first patch contribution trial here, please correct me if there is something wrong.
Thanks.
CCHsu
Attachment
On 2 July 2018 at 17:57, C,C H <a12321aabb@gmail.com> wrote: > I use tab-completion in psql quite often and I find that I can't complete > "FROM" for SELECT query. > > So I try to create a patch for it. > > I download the source code from GitHub master branch and modify the file to > create the patch. > > I compile the code and my code change works like follows, > -------------------------------------------------------------- > postgres=# SELECT * <Tab Key><Tab Key> > FROM INTO > postgres=# SELECT * > -------------------------------------------------------------- > > > This is my first patch contribution trial here, please correct me if there > is something wrong. Hi CCHsu, This looks useful, but it does overlap with my patch to add completion for column and function names to SELECT -- see https://commitfest.postgresql.org/18/1376/ . I have been quiet on this as everyone was (and still is) busy with the 11.0 release. I also have a patch for columns and functions after a comma in the select list, but I've been even more quiet on that one. We can try to combine them. It won't be as simple as your patch here, unfortunately. Luckily the completions are active at mostly* different times. Was the last word SELECT ? Offer a column or function name. Otherwise offer FROM/INTO. * note that FROM/INTO can also appear directly after SELECT! Cheers, Edmund