Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ... - Mailing list pgsql-hackers

From VASUKI M
Subject Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ...
Date
Msg-id CAE2r8H6TQa4ypCpM6cAsUQMjBpG=XB4Towvftts=JaMSkrvatQ@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ...  ("zengman" <zengman@halodbtech.com>)
Responses Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ...
Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ...
Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ...
List 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@halodbtech.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

pgsql-hackers by date:

Previous
From: "Joel Jacobson"
Date:
Subject: Re: Proposal: Add a UNIQUE NOT ENFORCED constraint
Next
From: Tender Wang
Date:
Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands