[PROPOSAL] psql tab completion: support ALTER ROLE ... IN DATABASE ... RESET
Hi hackers,
I'd like to work on a small psql tab-completion improvement.
Problem:
psql currently has a missing completion path for:
ALTER ROLE <role> IN DATABASE <db> RESET ...
There is an in-code TODO marker for this case in
src/bin/psql/tab-complete.in.c.
Proposal:
- Add completion support after "... IN DATABASE <db> RESET"
- Reuse existing completion behavior/style used by ALTER ROLE ... RESET
- Add regression coverage in src/bin/psql/t/010_tab_completion.pl
Non-goals:
- No backend behavior changes
- No SQL grammar changes
If this direction looks good, I can send a patch.
Thanks,
xianbinzhu
Hi hackers,
As discussed, here's a patch to add psql tab-completion support for:
ALTER ROLE/USER <name> IN DATABASE <db> RESET ...
Changes:
- Add completion path for "... IN DATABASE <db> RESET"
- Offer GUC names and ALL after RESET
- Add tab-completion test coverage in src/bin/psql/t/010_tab_completion.pl
Testing:
- make -j8
- make check (all tests passed in my environment)
Patch attached.
Thanks,
xianbinzhu
On Sun, Mar 29, 2026 at 2:50 PM Xianbin Zhu <xianbin.aaronzhu@gmail.com>
wrote:
Show quoted text
Hi hackers,
I'd like to work on a small psql tab-completion improvement.
Problem:
psql currently has a missing completion path for:
ALTER ROLE <role> IN DATABASE <db> RESET ...There is an in-code TODO marker for this case in
src/bin/psql/tab-complete.in.c.Proposal:
- Add completion support after "... IN DATABASE <db> RESET"
- Reuse existing completion behavior/style used by ALTER ROLE ... RESET
- Add regression coverage in src/bin/psql/t/010_tab_completion.plNon-goals:
- No backend behavior changes
- No SQL grammar changesIf this direction looks good, I can send a patch.
Thanks,
xianbinzhu