| From: | Ishjaap Singh <ishjaap(dot)singh07(at)gmail(dot)com> |
|---|---|
| To: | Sho Ito <i(dot)sho(dot)0628(at)gmail(dot)com> |
| Cc: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: [PATCH] psql: Fix REPACK index completion after a column list |
| Date: | 2026-11-12 02:09:09 |
| Message-ID: | CA+Y2Bmeg17WivUokE5w0Awyu9Si1nKZG+_OzK=+Ohp3hLpB=AA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, 11 Nov 2026 at 10:40, Sho Ito <i(dot)sho(dot)0628(at)gmail(dot)com> wrote:
> V3 retains the fixes for completing `INDEX` after an explicitly typed
> `USING` and looking up the correct table's indexes, including
> column-list forms with an option list.
Hi Sho,
I tested v3 (both patches) on master (8d87367b39e) with a GNU readline
build, and ran the psql TAP tests on REL_19_STABLE (1db7119ac65) too.
Before the patch, REPACK USING <Tab> gives "REPACK USING USING INDEX",
REPACK tab1 USING <Tab> completes nothing, and
REPACK (ANALYZE) tab1 (c1) USING INDEX <Tab><Tab> offers indexes from
unrelated tables. With v3 the first two complete INDEX, and the last
one completes to tab1's index. That also works with a schema-qualified
table and with a quoted mixed-case one. The server accepts the
resulting column-list statements for the plain and the quoted table.
Removing the catch-all TailMatches(MatchAny, "USING", "INDEX") rule
looks safe to me. ALTER TABLE's PRIMARY KEY/UNIQUE and REPLICA IDENTITY
forms have their own completion rules, and
ALTER TABLE ONLY ... ADD PRIMARY KEY USING INDEX <Tab><Tab> lists the
same indexes before and after v3.
The psql TAP tests pass on both branches. Without the
tab-complete.in.c change, the TAP run fails at the first new REPACK
check. pgindent is clean; pgperltidy wants two lines in the new tests
rewrapped.
I agree with leaving the ANALYZE check for a later patch. With v3,
REPACK (VERBOSE) tab1 (c1) USING <Tab> offers INDEX, which the server
rejects; that's the case the check would cover. A related case:
REPACK (CONCURRENTLY) USING <Tab> and REPACK (ANALYZE) USING <Tab> now
complete INDEX, and the server rejects both without a table name.
Those already gave invalid SQL before v3 ("USING USING INDEX"), so I
don't think either case blocks this patch.
A heads-up: this conflicts with my patch for the same block [1], which
stops offering USING INDEX right after REPACK (CONCURRENTLY) and
REPACK (ANALYZE), where a table name is required. The conflicts are in
adjacent completion rules and the test insertion point. I'm happy to
rebase whichever one lands second.
Looks good to me.
[1] https://commitfest.postgresql.org/patch/7574/
Thanks,
Ishjaap Singh
| From | Date | Subject | |
|---|---|---|---|
| Previous Message | Chao Li | 2026-11-12 01:37:28 | Re: [PATCH] pg_input_is_valid() reuses the first type name inside a PL/pgSQL loop |