Re: psql: Add tab completion for ALTER USER RESET

Tomas Vondra <tomas@vondra.me>

From: Tomas Vondra <tomas@vondra.me>
To: Robins Tharakan <tharakan@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-12-09T22:39:03Z
Lists: pgsql-hackers
Hi,

On 11/29/24 09:42, Robins Tharakan wrote:
> Hi,
> 
> Please find attached a patch to help tab completion show only currently
> set vars
> during ALTER USER RESET.
> 
> Currently tab completion provides a list of all vars which is only
> partially helpful.
> This patch allows tab completion to see which vars are currently set for
> the role
> and only show those options during tab completion.
> 

Yeah, this looks convenient. Without the patch we'd get

...
Display all 200 possibilities? (y or n)

and then a wall of text with all the options. With the patch we get only
options that are actually set for the user, which is much better.

Two comments:

1) Does it make sense to still show "ALL" when the query returns
nothing? Not sure if we already have a way to handle this.

2) Should we do the same thing for ALTER DATABASE? That also allows
setting options.


thanks

-- 
Tomas Vondra




Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add tab completion for ALTER DATABASE RESET

  2. Add tab completion for ALTER USER/ROLE RESET