Remove "FROM" in "DELETE FROM" when using tab-completion

From: "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Remove "FROM" in "DELETE FROM" when using tab-completion
Date: 2021-05-10 05:36:35
Message-ID: OS0PR01MB61135AE2B07CCD1AB8C6A0F6FB549@OS0PR01MB6113.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

When using psql help with SQL commands, I found an inconsistency tab-completion for command "DELETE" as follows.

=# \h de[TAB]
deallocate declare delete from

=# \help[TAB]
ABORT CLUSTER DELETE FROM

=# \help[ENTER]
Available help:
...
ANALYZE CREATE OPERATOR CLASS DELETE
...

=# \h delete
Command: DELETE
Description: delete rows of a table
...

You see, the tab-completion for "DELETE" is "DELETE FROM" which is not same as help-command said(which is "DELETE").
I tried to figure out why "FROM" is introduced here, but no good result got. In [1] someone changed "DELETE" to "DELETE FROM" but no reason added.

IMO, the "FROM" is unnecessary just like "INTO" for "INSERT" command. So I tried to fix the inconsistency by removing "FROM" from "DELETE FROM" in tab-complete.c.
Please see the attached patch. Any comment or different thought is very welcome.

[1]
https://github.com/postgres/postgres/commit/4c1f9a0f0bb41c31b26bb88ba8c5d3fca4521dd7

Regards,
Tang

Attachment Content-Type Size
0001-Remove-FROM-in-DELETE-FROM.patch application/octet-stream 1.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2021-05-10 05:48:15 Re: Remove "FROM" in "DELETE FROM" when using tab-completion
Previous Message Peter Smith 2021-05-10 05:21:02 Re: [HACKERS] logical decoding of two-phase transactions