Subject: [PROPOSAL] psql tab completion: support ALTER ROLE ... IN DATABASE ... RESET

From: Xianbin Zhu <[email-masked]>
Date: Sun, 29 Mar 2026 14:50:28 +0800

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

---

From: Xianbin Zhu <[email-masked]>
Date: Sun, 29 Mar 2026 15:05:11 +0800

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