pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Improve tab completion for various SET/RESET forms
Date: Wed, 11 Jun 2025 11:06:42 +0100
Message-ID: <871prqwq19.fsf@wibble.ilmari.org> (raw)
In-Reply-To: <18691637-2af2-4a2f-9f12-8201c2a88206@eisentraut.org>
References: <87bjqwwtic.fsf@wibble.ilmari.org>
	<18691637-2af2-4a2f-9f12-8201c2a88206@eisentraut.org>

Peter Eisentraut <peter@eisentraut.org> writes:

> On 09.06.25 22:27, Dagfinn Ilmari Mannsåker wrote:
>> 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.
>
> These technical changes seem fine, but I haven't looked in detail.  But
> I want to say that I don't like this proposed behavior change at all.

This is not the first case of behaviour like this: there's precedence
for it for ALTER DATABASE ... RESET and ALTER ROLE ... RESET (but that
was buggy and is fixed by the first patch in the series): they only
complete variables that are actually set on the relevant entity. See the
thread at
https://postgr.es/m/CAEP4nAzqiT6VbVC5r3nq5byLTnPzjniVGzEMpYcnAHQyNzEuaw%40mail.gmail.com

Why should the session be any different?

> don't think tab completion should filter out by things that are probably
> not interesting or useful depending on session state.  That could be 
> very confusing, especially since there is no surface to explain this
> anywhere.  The obvious extreme case is that RESET in a fresh session 
> wouldn't offer any completions at all.

That's not the case, as mentioned in the commit message for the final
patch: it also completes with the keywords ALL, ROLE and SESSION (which
will subsequently be completed with AUTHORIZATION).

Also, it's a handy way of seeing which variables have been set in the
current session, withouth having to query pg_settings manually.

- ilmari





view thread (15+ messages)  latest in thread

Message-ID: <871prqwq19.fsf@wibble.ilmari.org>
Permalink:  ../871prqwq19.fsf@wibble.ilmari.org/
Also on:    postgresql.org/message-id/871prqwq19.fsf@wibble.ilmari.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: ilmari@ilmari.org, peter@eisentraut.org
  Subject: Re: Improve tab completion for various SET/RESET forms
  In-Reply-To: <871prqwq19.fsf@wibble.ilmari.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox