From: | Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Improve tab completion for various SET/RESET forms |
Date: | 2025-06-09 20:27:07 |
Message-ID: | 87bjqwwtic.fsf@wibble.ilmari.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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 | Content-Type | Size |
---|---|---|
0001-Fix-tab-completion-for-ALTER-ROLE-USER-.-RESET.patch | text/x-diff | 1.7 KB |
0002-Add-tab-completion-for-ALTER-TABLE-.-ALTER-COLUMN-.-.patch | text/x-diff | 1.7 KB |
0003-Add-tab-completion-for-ALTER-FOREIGN-TABLE-.-SET.patch | text/x-diff | 1.1 KB |
0004-Remove-guard-against-generic-completion-after-ALTER-.patch | text/x-diff | 1.1 KB |
0005-Improve-tab-completion-for-RESET.patch | text/x-diff | 1.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Dagfinn Ilmari Mannsåker | 2025-06-09 20:33:46 | Re: Improve tab completion for various SET/RESET forms |
Previous Message | Nathan Bossart | 2025-06-09 20:26:17 | Re: add function for creating/attaching hash table in DSM registry |