[PATCH] psql: Fix REPACK index completion after a column list

From: Sho Ito <i(dot)sho(dot)0628(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [PATCH] psql: Fix REPACK index completion after a column list
Date: 2026-11-08 22:12:39
Message-ID: CAG7L5+7Xmus+JLa0m=Lpw49wU=secPm5dzNd2ibmfvhdSYEfqA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

After a column list, psql's index completion for `REPACK` offers indexes
from unrelated tables. For example:

```
REPACK (ANALYZE) tab1 (c1) USING INDEX <Tab>
```

The completion code uses `prev3_wd` as the table name, but that word is
the column list in this form. The table-specific query returns nothing,
and completion falls back to listing all indexes.

The attached fix uses `prev4_wd` when a column list is present. It also
completes `USING INDEX` after the column list.

The regression tests are in a separate patch extending the existing
`src/bin/psql/t/010_tab_completion.pl`.

Thanks,
Sho

--
=======================================
*Sho Ito (Sean)*

E-mail: i(dot)sho(dot)0628(at)gmail(dot)com
LinkedIn: *https://www.linkedin.com/in/sho-ito-0628/
<https://www.linkedin.com/in/sho-ito-0628/>*
GitHub: https://github.com/sean0628/
=======================================

Attachment Content-Type Size
v1-0001-psql-Fix-REPACK-index-completion-after-a-column-list.patch application/octet-stream 2.0 KB
v1-0001-psql-Test-REPACK-index-completion-after-a-column-list.patch application/octet-stream 2.0 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Sho Ito 2026-11-08 22:23:05 [PATCH] psql: Complete INDEX after REPACK USING
Previous Message Lucas Jeffrey 2026-11-08 21:50:55 Re: Postgres fdw: Bug in InitPgFdwOptions initialization can cause an esoteric crash