Re: [PATCH] Improve tab completion after CREATE INDEX key list

From: Koshino Taiki <koshino(at)sraoss(dot)co(dot)jp>
To: Sho Ito <i(dot)sho(dot)0628(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Improve tab completion after CREATE INDEX key list
Date: 2026-12-01 05:19:17
Message-ID: TY7P286MB9749444EDE6D4538D1E2A681D8944E2@TY7P286MB974944.JPNP286.PROD.OUTLOOK.COM
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> I reviewed v1 on master with assertions enabled. All four psql TAP suites
> pass, as do additional checks covering the supported forms, quoted index
> names, expressions, and `CREATE SCHEMA` embedding. It looks good to me.
>
> Regarding the tests, I'm not sure if we need a separate test for each supported
> form, given the discussion in [1].
> [1] https://www.postgresql.org/message-id/flat/CAHza6qdYj10_sj7L1BsVubw7VkH-YepFXxfNM4jA1cupgDd-Qg%40mail.gmail.com#0096ee8864c79c11524dbb14ffc01649

Hi Ito-san,

Thank you for reviewing and testing the patch.

Following your suggestion, I reduced the tests to the two functionally
different completion points, rather than testing each supported syntax
form separately.

I have also added your Reviewed-by tag to the commit message.

The updated v2 patch is attached.

Regards,

Taiki Koshino<koshino(at)sraoss(dot)co(dot)jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/

________________________________
差出人: Sho Ito <i(dot)sho(dot)0628(at)gmail(dot)com>
送信日時: 2026年11月29日 9:38
宛先: Koshino Taiki <koshino(at)sraoss(dot)co(dot)jp>
CC: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
件名: Re: [PATCH] Improve tab completion after CREATE INDEX key list

Hi Taiki,

I reviewed v1 on master with assertions enabled. All four psql TAP suites
pass, as do additional checks covering the supported forms, quoted index
names, expressions, and `CREATE SCHEMA` embedding. It looks good to me.

Regarding the tests, I'm not sure if we need a separate test for each supported
form, given the discussion in [1].

[1] https://www.postgresql.org/message-id/flat/CAHza6qdYj10_sj7L1BsVubw7VkH-YepFXxfNM4jA1cupgDd-Qg%40mail.gmail.com#0096ee8864c79c11524dbb14ffc01649

Thanks,
Sho

On Thu, Nov 26, 2026 at 5:08 PM Koshino Taiki <koshino(at)sraoss(dot)co(dot)jp<mailto:koshino(at)sraoss(dot)co(dot)jp>> wrote:
Hi,

psql currently offers no completion after a CREATE INDEX key list:

postgres=# CREATE INDEX idx ON tab1 (c1) <Tab>

The attached patch offers the clauses valid at this position:

INCLUDE ( NULLS DISTINCT NULLS NOT DISTINCT WITH ( TABLESPACE WHERE

It also completes the remainder of NULLS:

postgres=# CREATE UNIQUE INDEX idx ON tab1 (c1) NULLS <Tab>
DISTINCT NOT DISTINCT

The change covers named and unnamed indexes, with CONCURRENTLY and
USING where applicable. It is limited to forms already recognized by
the existing completion rules; IF NOT EXISTS and ONLY would require
changes to earlier completion stages.

Tests for the supported forms are included.

Regards,
Taiki Koshino

Taiki Koshino<koshino(at)sraoss(dot)co(dot)jp<mailto:koshino(at)sraoss(dot)co(dot)jp>>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/

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

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

Attachment Content-Type Size
v2-0001-Improve-tab-completion-after-CREATE-INDEX-key-lis.patch application/octet-stream 3.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ideriha, Takeshi 2026-12-01 05:23:28 Re: [PATCH] pgcrypto: Fix sha-crypt rounds= values that do not fit in int (BUG #19743)
Previous Message Tom Lane 2026-12-01 05:17:52 Re: Should we skip foreign key checks in binary upgrade mode?