Re: Improving psql autocompletion for SET LOCAL / SET SESSION - Mailing list pgsql-hackers

From solai v
Subject Re: Improving psql autocompletion for SET LOCAL / SET SESSION
Date
Msg-id CAF0whufL-5A--_T+QkD71iQFkD1DEwQVFZjwZEnXxitLjRymkQ@mail.gmail.com
Whole thread
Responses Re: Improving psql autocompletion for SET LOCAL / SET SESSION
List pgsql-hackers
Hi,


> I am thinking maybe we could split the cases as
>     /* Complete "SET LOCAL" */
>     else if (Matches("SET", "LOCAL"))
>         COMPLETE_WITH_QUERY_VERBATIM_PLUS(Query_for_list_of_set_vars,
>                                           "TIME ZONE",
>                                           "SCHEMA",
>                                           "NAMES");
>     /* Complete "SET SESSION" */
>     else if (Matches("SET", "SESSION"))
>         COMPLETE_WITH_QUERY_VERBATIM_PLUS(Query_for_list_of_set_vars,
>                                           "AUTHORIZATION",
>                                           "CHARACTERISTICS AS TRANSACTION",
>                                           "TIME ZONE",
>                                           "SCHEMA",
>                                           "NAMES");
>
> and remove the now-redundant later Matches("SET", "SESSION") block
>
> Worth considering whether ROLE should be in both lists too, since SET LOCAL ROLE … and SET SESSION ROLE … are both
valid.
>
> Regards,
> Surya Poondla

I tested the patch and was able to reproduce the regression that Surya
pointed out.

Before applying the patch:
   SET LOCAL <TAB> completed to TO.
   SET SESSION <TAB> suggested AUTHORIZATION and CHARACTERISTICS AS TRANSACTION.

After applying the patch:
    SET LOCAL <TAB> correctly shows configuration variable completions
along with TIME ZONE, SCHEMA, and NAMES.
    SET SESSION <TAB> also shows the configuration variable list, but
no longer suggests AUTHORIZATION or CHARACTERISTICS AS TRANSACTION.

I also experimented with separating the SET LOCAL and SET SESSION
completion rules, similar to the approach suggested by Surya, and
tried a few variations while testing. However, I was not able to
restore the previous SET SESSION completion behavior in my
environment.
So I can reproduce both the original issue and the regression, but I
do not yet have a verified fix.
Are there any additional ideas or approaches that I should investigate
to preserve the existing SET SESSION completions while keeping the new
SET LOCAL behavior?

regards
Solai



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: REPACK CONCURRENTLY fails on tables with generated columns
Next
From: jian he
Date:
Subject: Re: Row pattern recognition