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

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Sho Ito <i(dot)sho(dot)0628(at)gmail(dot)com>
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-18 12:48:38
Message-ID: av2bx2mRrcCYiiM0@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

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.

On the other hand, I think we could offer the opening "(" after the
table name, when an option list is present (I would do this regardless
of the ANALYZE begin present or not. If they add a column list with
options other than analyze, they get the error, but that's not too big a
problem. At worst, they discover that it's possible to list columns in
certain cases; for their next try they can either add the analyze or
drop the column list, at their preference. In fact, I wonder if we
should offer to add a column list even if there's no option list even
if it's not valid without it.)

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:

/*
* Make sure ANALYZE is specified if a column list is present.
*/
if ((params->options & CLUOPT_ANALYZE) == 0 && stmt->relation->va_cols != NIL)
ereport(ERROR,
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("ANALYZE option must be specified when a column list is provided"));

That would make the syntax less problematic: you're always "welcome" to
add a column list, only it will be ignored in some cases.

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
Tom: There seems to be something broken here.
Teodor: I'm in sackcloth and ashes... Fixed.
http://postgr.es/m/482D1632.8010507@sigaev.ru

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2026-11-18 12:52:11 Re: GetRelationPath() vs critical sections
Previous Message Amit Kapila 2026-11-18 12:31:53 Re: Assertion failure in update_local_synced_slot(), slotsync.c:364