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

From: Sho Ito <i(dot)sho(dot)0628(at)gmail(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: Ishjaap Singh <ishjaap(dot)singh07(at)gmail(dot)com>, 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-23 05:58:24
Message-ID: CAG7L5+5Z=rpq7P=mERH1O9vVRuVGBSpShrxBWROsnC0iOswJyg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Álvaro,

Sorry for the late reply. Thank you for the review.

> Hmm, so the commit message says
>
> Leave completion directly after a column list unchanged. Adding USING
> INDEX there requires accounting for the ANALYZE option and is deferred
> to a separate change.
>
> but that's not correct, isn't it? It's offering a column list itself
> that's problematic (i.e., it requires the analyze option to be present),
> not the USING INDEX clause. I don't see why we wouldn't offer to add
> USING INDEX.
>

You're right; the commit message conflated the column-list requirement
with the subsequent `USING INDEX` clause. V5 corrects that explanation,
completes `USING INDEX` after a column list, and offers `(` after a table
name when an option list is present, without checking `ANALYZE`.

> Is really REPACK the first command where the syntax causes this kind of
> problem? Hmm, I'm now wondering if we should make this error a WARNING
> instead:
>

There is a similar restriction in `VACUUM`: `ExecVacuum()` rejects a
column list without `ANALYZE`, using the same error message [1]. I'd keep
any change from an error to a warning separate from this completion
fix and consider the behaviour of both commands together.

[1]
https://github.com/postgres/postgres/blob/c074737f687f604b64f6ee830fccbbe854719823/src/backend/commands/vacuum.c#L341-L354

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
v5-0002-psql-Add-regression-tests-for-REPACK-tab-completi.patch application/octet-stream 3.9 KB
v5-0001-psql-Fix-REPACK-tab-completion-around-USING-INDEX.patch application/octet-stream 2.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2026-11-23 06:29:11 Re: Row pattern recognition
Previous Message Peter Smith 2026-11-23 05:55:34 Re: [PATCH] Report changes discarded for relations not in the subscription