Re: Fix tab completion in v18 for ALTER DATABASE/USER/ROLE ... RESET

From: Tomas Vondra <tomas(at)vondra(dot)me>
To: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, jian he <jian(dot)universality(at)gmail(dot)com>, Robins Tharakan <tharakan(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Fix tab completion in v18 for ALTER DATABASE/USER/ROLE ... RESET
Date: 2025-07-29 17:13:13
Message-ID: 54b435ab-ce2a-4a65-b4a9-35633dea2b28@vondra.me
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 7/22/25 13:18, Dagfinn Ilmari Mannsåker wrote:
> jian he <jian(dot)universality(at)gmail(dot)com> writes:
>
>> On Thu, Jul 17, 2025 at 1:41 AM Dagfinn Ilmari Mannsåker
>> <ilmari(at)ilmari(dot)org> wrote:
>>>
>>> Hi hackers,
>>>
>>> These two patches are split out from my earlier thread about improving
>>> tab completion for varous RESET forms
>>> (https://postgr.es/m/87bjqwwtic.fsf@wibble.ilmari.org) so that the bug
>>> fixes can be tracked as an open item for v18.
>>>
>>> Commits 9df8727c5067 and c407d5426b87 added tab completion for ALTER
>>> DATABASE ... RESET and ALTER ROLE/USER ... RESET, respectively, but
>>> they're both differently buggy. The query for the DATABASE form
>>> neglected to schema-qualify the unnest() call, and the query for the
>>> ROLE/USER form shows all possible variables once you start typing a
>>> variable name, not just the ones that are set on the role. The attached
>>> patches fix both.
>>>
>>
>> I played around with it, and overall it looks good.
>
> Thanks for the review.
>
> I realise I should have included Robins and Tomas in the original mail,
> since they were the author and committer, respectively, of the original
> patches. I've added them now, and reattached the patches for their
> convenience.
>

Thanks for the fixes. Both seem correct to me. It took me a while to
reproduce some sort of issue with unnest(), but that was mostly because
I didn't realize the tab completion does not report errors to the user.

While testing the ALTER ROLE part, I realized there's a second related
issue with similar symptoms - after starting to type a variable that is
*not* set for the role, it was offering all matching variables anyway. I
believe that's because of the block at line ~5022. The "database" case
was already excluded, so I made 0002 to do that for ROLE too.

I plan to push the attached fixes soon ...

regards

--
Tomas Vondra

Attachment Content-Type Size
v2-0002-Fix-tab-completion-for-ALTER-ROLE-USER-.-RESET.patch text/x-patch 2.9 KB
v2-0001-Schema-qualify-unnest-in-ALTER-DATABASE-.-RESET.patch text/x-patch 1.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2025-07-29 17:41:05 Re: pg_dump --with-* options
Previous Message Daniel Bauman 2025-07-29 17:07:19 Re: Doc update proposal for the note on log_statement in the runtime config for logging page