Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ...

From: VASUKI M <vasukianand0119(at)gmail(dot)com>
To: zengman <zengman(at)halodbtech(dot)com>
Cc: Ian Lawrence Barwick <barwick(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, surya poondla <suryapoondla4(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Dharin Shah <dharinshah95(at)gmail(dot)com>
Subject: Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ...
Date: 2026-01-06 06:49:14
Message-ID: CAE2r8H6TQa4ypCpM6cAsUQMjBpG=XB4Towvftts=JaMSkrvatQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

Thanks everyone for the reviews and discussion — I appreciate the time
spent looking at this.

Based on the feedback, I’ve prepared v4 of the patch with the following
updates:

Added a safety guard before calling PQescapeLiteral() to ensure pset.db is
non-NULL and in CONNECTION_OK state, falling back to ALL otherwise.

Kept the RESET completion limited to parameters actually present in
pg_db_role_setting, matching the behavior of other object-specific RESET
forms.

No changes to tab-completion APIs or libreadline interactions.

Regarding tests: I initially attempted to add TAP coverage via
src/bin/psql/t/010_tab_completion.pl, but based on Tom and Robert’s
comments[on discord], that file is intended to validate libreadline
mechanics rather than individual SQL completion cases. Since this change
does not introduce new readline behavior and SQL-based completion paths
during continuation prompts are not reliably exercised by the current test
harness, I’ve left the patch without TAP coverage.

I’m happy to adjust if there is a preferred place or pattern for testing
this kind of completion in the future.

Thanks again for the guidance.

On Mon, Dec 29, 2025 at 1:18 PM zengman <zengman(at)halodbtech(dot)com> wrote:

> Hi,
>
> I got lots of indentation-related warnings when running git apply (see
> output below).
> Also, I found an issue: the RESET command unexpectedly displays
> "work_mem=16MB",
> which is not correct. I've made a minor fix by adding split_part and
> attached the v3 patch.
>
> Sorry my system is unable to indent with the 2.1.2 version as it is not
yet released,I’ve aligned the indentation with the surrounding code, and CI
/ buildfarm should catch any remaining formatting issues.

Could you please take a look and see if this modification is correct?
>

Yeah,thanks.

Regards,
Vasuki M
C-DAC,Chennai

Attachment Content-Type Size
v4-0001-psql-alter-role-in-database-tab-completion.patch text/x-patch 3.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tender Wang 2026-01-06 07:13:59 Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Previous Message Joel Jacobson 2026-01-06 06:43:07 Re: Proposal: Add a UNIQUE NOT ENFORCED constraint