Add MERGE and VALUES statements to tab completion for PREPARE

Started by Haruna Miwa12 months ago5 messageshackers
Jump to latest
#1Haruna Miwa
miwa@sraoss.co.jp

Hi,

As described in the manual[1]https://www.postgresql.org/docs/devel/sql-prepare.html, PREPARE ... AS command supports MERGE and VALUES statements, but current psql's tab completion does not suggest them.
I created a patch that enables MERGE and VALUES to appear as tab completion suggestions.

What do you think?

[1]: https://www.postgresql.org/docs/devel/sql-prepare.html

--
Haruna Miwa

Attachments:

0001-Add-MERGE-and-VALUES-statements-to-tab-completion-fo.patchapplication/octet-stream; name=0001-Add-MERGE-and-VALUES-statements-to-tab-completion-fo.patchDownload+1-2
#2Fujii Masao
masao.fujii@gmail.com
In reply to: Haruna Miwa (#1)
Re: Add MERGE and VALUES statements to tab completion for PREPARE

On Mon, Nov 10, 2025 at 9:41 AM Haruna Miwa <miwa@sraoss.co.jp> wrote:

Hi,

As described in the manual[1], PREPARE ... AS command supports MERGE and VALUES statements, but current psql's tab completion does not suggest them.
I created a patch that enables MERGE and VALUES to appear as tab completion suggestions.

What do you think?

+1

Should we suggest "MERGE INTO" instead of just "MERGE",
since INTO always follows MERGE?

Also, how about adding "TABLE" and "WITH" to the suggestions,
similar to the tab-completion for "COPY ("?
SELECT statement can be specified in the PREPARE command,
and it can start with SELECT, TABLE, or WITH [1]https://www.postgresql.org/docs/devel/sql-select.html.

Regards,

[1]: https://www.postgresql.org/docs/devel/sql-select.html

Regards,

--
Fujii Masao

#3Haruna Miwa
miwa@sraoss.co.jp
In reply to: Fujii Masao (#2)
Re: Add MERGE and VALUES statements to tab completion for PREPARE

Should we suggest "MERGE INTO" instead of just "MERGE",
since INTO always follows MERGE?

Also, how about adding "TABLE" and "WITH" to the suggestions,
similar to the tab-completion for "COPY ("?
SELECT statement can be specified in the PREPARE command,
and it can start with SELECT, TABLE, or WITH [1].

Agreed.
I have updated the patch.

Regards,
--
Haruna Miwa
________________________________
差出人: Fujii Masao <masao.fujii@gmail.com>
送信: 2025 年 11 月 10 日 (月曜日) 14:15
宛先: Haruna Miwa <miwa@sraoss.co.jp>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
件名: Re: Add MERGE and VALUES statements to tab completion for PREPARE

On Mon, Nov 10, 2025 at 9:41 AM Haruna Miwa <miwa@sraoss.co.jp> wrote:

Hi,

As described in the manual[1], PREPARE ... AS command supports MERGE and VALUES statements, but current psql's tab completion does not suggest them.
I created a patch that enables MERGE and VALUES to appear as tab completion suggestions.

What do you think?

+1

Should we suggest "MERGE INTO" instead of just "MERGE",
since INTO always follows MERGE?

Also, how about adding "TABLE" and "WITH" to the suggestions,
similar to the tab-completion for "COPY ("?
SELECT statement can be specified in the PREPARE command,
and it can start with SELECT, TABLE, or WITH [1]https://www.postgresql.org/docs/devel/sql-select.html.

Regards,

[1]: https://www.postgresql.org/docs/devel/sql-select.html

Regards,

--
Fujii Masao

Attachments:

v2-0001-Add-MERGE-VALUES-WITH-and-TABLE-to-PREPARE-tab-co.patchapplication/octet-stream; name=v2-0001-Add-MERGE-VALUES-WITH-and-TABLE-to-PREPARE-tab-co.patchDownload+1-2
#4Fujii Masao
masao.fujii@gmail.com
In reply to: Haruna Miwa (#3)
Re: Add MERGE and VALUES statements to tab completion for PREPARE

On Thu, Nov 20, 2025 at 3:05 PM Haruna Miwa <miwa@sraoss.co.jp> wrote:

Should we suggest "MERGE INTO" instead of just "MERGE",
since INTO always follows MERGE?

Also, how about adding "TABLE" and "WITH" to the suggestions,
similar to the tab-completion for "COPY ("?
SELECT statement can be specified in the PREPARE command,
and it can start with SELECT, TABLE, or WITH [1].

Agreed.
I have updated the patch.

Thanks for the update!

The patch looks good to me. I made one small adjustment: the updated line
was a bit long, so I added a line break. I also revised the commit message.

The updated patch is attached. I'll go ahead and commit it.

Regards,

--
Fujii Masao

Attachments:

v3-0001-psql-Improve-tab-completion-for-PREPARE.patchapplication/octet-stream; name=v3-0001-psql-Improve-tab-completion-for-PREPARE.patchDownload+2-2
#5Fujii Masao
masao.fujii@gmail.com
In reply to: Fujii Masao (#4)
Re: Add MERGE and VALUES statements to tab completion for PREPARE

On Fri, Nov 21, 2025 at 3:33 PM Fujii Masao <masao.fujii@gmail.com> wrote:

On Thu, Nov 20, 2025 at 3:05 PM Haruna Miwa <miwa@sraoss.co.jp> wrote:

Should we suggest "MERGE INTO" instead of just "MERGE",
since INTO always follows MERGE?

Also, how about adding "TABLE" and "WITH" to the suggestions,
similar to the tab-completion for "COPY ("?
SELECT statement can be specified in the PREPARE command,
and it can start with SELECT, TABLE, or WITH [1].

Agreed.
I have updated the patch.

Thanks for the update!

The patch looks good to me. I made one small adjustment: the updated line
was a bit long, so I added a line break. I also revised the commit message.

The updated patch is attached. I'll go ahead and commit it.

I've pushed the patch. Thanks!

Regards,

--
Fujii Masao