Thread: Improve tab completion for various SET/RESET forms

Improve tab completion for various SET/RESET forms

From
Dagfinn Ilmari Mannsåker
Date:
Hi hackers,

I noticed that psql tab-completes every possible session-settable
variable after RESET, not just the ones that have actually been set in
the current session.  However, as I was fixing that I noticed several
other deficiencies around other forms of SET/RESET.  So, here's the
resulting yak stack.

Feel free to squash them as desired when committing, I just find it
easier to explain each thing as a separate commit/patch.

1. Fix tab completion for ALTER ROLE/USER ... RESET

   It was trying to get the variables set for the current user, but the
   query only worked on the intial tab after RESET, not when you started
   typing a prefix to pick the one you wanted.  Fix in the same way as
   ALTER DATABASE ... RESET does it.

2. Add tab completion for ALTER TABLE ... ALTER COLUMN ... RESET

   Complete with "(" and then the same as after ALTER COLUMN ... SET (.

   There are only two possible attribute options, so no need to filter
   down to the ones that have actually been set.

3. Add tab completion for ALTER FOREIGN TABLE ... SET

   Setting the schema is the only supported thing.

4. Remove guard against generic SET/RESET completion after ALTER TABLE
   ... RESET

   This is already handled specifically earlier in the code.  Only
   UPDATE is later and needs guarding against.

5. The actual patch I set out to write: only complete variables that
   have actually been set in the current session after RESET.

- ilmari
-- part-time yak stylist


Attachment

Re: Improve tab completion for various SET/RESET forms

From
Dagfinn Ilmari Mannsåker
Date:
Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> writes:

> Hi hackers,
>
> I noticed that psql tab-completes every possible session-settable
> variable after RESET, not just the ones that have actually been set in
> the current session.  However, as I was fixing that I noticed several
> other deficiencies around other forms of SET/RESET.  So, here's the
> resulting yak stack.

Added to the next commitfest:
https://commitfest.postgresql.org/patch/5810/

- ilmari