Re: [PATCH] Tab completion for ALTER TABLE … ADD …

Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>

From: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
To: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2021-08-27T10:52:33Z
Lists: pgsql-hackers

Attachments

Michael Paquier <michael@paquier.xyz> writes:

> On Tue, Aug 03, 2021 at 12:48:38PM +0100, Dagfinn Ilmari Mannsåker wrote:
>> The other day I noticed that there's no tab completion after ALTER TABLE
>> … ADD, so here's a patch.  In addition to COLUMN and all the table
>> constraint types, it also completes with the list of unique indexes on
>> the table after ALTER TABLE … ADD … USING INDEX.
>
> I was reading this patch (not actually tested), and that's a clear
> improvement.  One extra thing that could be done here is to complete
> with types for a ALTER TABLE ADD COLUMN foo.

That was easy enough to add (just a bit of extra fiddling to handle
COLUMN being optional), done in the attached v2 patch.

> We could as well have a list of columns after UNIQUE or PRIMARY KEY,
> but that feels like extra cream on top of the cake.

Doing a list of arbitrarily many comma-separated names is more
complicated, so that can be the subject for another patch.

>  In short I am fine with what you have here.

Thanks for the review.

- ilmari

Commits

  1. Add tab completion for data types after ALTER TABLE ADD [COLUMN] in psql

  2. Add more tab completion support for ALTER TABLE ADD in psql