Re: Improving psql autocompletion for SET LOCAL / SET SESSION

From: surya poondla <suryapoondla4(at)gmail(dot)com>
To: solai v <solai(dot)cdac(at)gmail(dot)com>
Cc: Álvaro Rodríguez <alvaro(at)datadoghq(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Improving psql autocompletion for SET LOCAL / SET SESSION
Date: 2026-06-16 22:21:12
Message-ID: CAOVWO5qB39a87YZzWxPK1WROxPNvRhJNELemqoX8w61d_mn2qQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Álvaro, Solai

Thank you for working on the v2 patch.

I have a few comments:
1. SET LOCAL/SESSION for both we can also add TRANSACTION too in the tab
completion as both SET LOCAL TRANSACTION ISOLATION LEVEL READ
COMMITTED;, SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; are
valid.

2. SET SESSION list has both AUTHORIZATION and SESSION AUTHORIZATION. we
can remove the SESSION AUTHORIZATION and only keep AUTHORIZATION

3. Once LOCAL/SESSION is typed, the next tab stops working, this looks like
an existing gap but the v2 patch made it more visible.
SET LOCAL <var> <TAB>' should suggest TO, but doesn't.
SET LOCAL <var> TO <TAB>' should suggest GUC values

Same applies for SET SESSION too. The fix can be extended to something like
SET SESSION <var>. Fix is to teach both rules to accept an optional
LOCAL|SESSION slot, e.g.:
else if (Matches("SET", "LOCAL|SESSION", MatchAny) ||
Matches("SET", MatchAny))
COMPLETE_WITH("TO");

else if ((TailMatches("SET", MatchAny, "TO|=") ||
TailMatches("SET", "LOCAL|SESSION", MatchAny, "TO|=")) &&
!TailMatches("UPDATE", MatchAny, "SET", MatchAny, "TO|="))
{ ... }

or we can keep this for a follow-up patch.

Regards,
Surya Poondla

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Enrique Sánchez 2026-06-16 22:32:40 Re: Extended statistics improvement: multi-column MCV missing values
Previous Message Robert Haas 2026-06-16 21:53:55 Re: use of SPI by postgresImportForeignStatistics