RE: 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: Julien Rouhaud <rjuju123(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Julien Rouhaud <rjuju123(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: Remove "FROM" in "DELETE FROM" when using tab-completion
Date: 2021-05-10 06:36:19
Message-ID: OS0PR01MB61137F38690B7F72577361CAFB549@OS0PR01MB6113.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Monday, May 10, 2021 2:48 PM, Julien Rouhaud <rjuju123(at)gmail(dot)com> worte
>I think the behavior now is correct. The goal of autocompletion is to save
>keystrokes and time. As the only valid keyword after a DELETE (at least in a
>DeleteStmt) is FROM, it's a good thing that you get back "DELETE FROM" directly
>rather than asking that to autocomplete in multiple steps.
>
>Now, the \help command is for commands, which is a different thing as the
>command in that case is DELETE not DELETE FROM, even if you will have to follow
>your DELETE with a FROM.

Thanks for your reply. I totally agree with you on the convenience of "DELETE FROM" autocompletion.
But I also noticed some autocompletion for "DELETE" in some cases is just "DELETE" already.

=# EXPLAIN[TAB]
ANALYZE DECLARE DELETE INSERT SELECT UPDATE VERBOSE

=# COPY ([TAB]
DELETE INSERT SELECT TABLE UPDATE VALUES WITH

Maybe we should keep the behavior consistent?
I mean we can change all "DELETE" to "DELETE FROM" or just remove "FROM" for consistency.

On Monday, May 10, 2021 2:51 PM, Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote
>I agree with Julien. But, I also agree with the consistency point
>from Tang. So maybe we can fix the insert and add INSERT INTO in the
>tab completion?

Yeah. Change "INSERT" to "INSERT INTO" can be a good solution, too.
But just like I mentioned above, some cases in tab-completion make "DELETE" to "DELETE FROM", some cases make "DELETE" to "DELETE".
I'm not sure which cases could change "INSERT" to "INSERT INTO".
Please share with me your thought on it.

Regards,
Tang

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message houzj.fnst@fujitsu.com 2021-05-10 06:46:54 RE: Parallel INSERT SELECT take 2
Previous Message Tom Lane 2021-05-10 06:32:01 Re: strange case of "if ((a & b))"