Re: [Patch]Add tab completion for DELETE ... USING

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Tatsuya Kawata <kawatatatsuya0913(at)gmail(dot)com>
Cc: Soumya S Murali <soumyamurali(dot)work(at)gmail(dot)com>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [Patch]Add tab completion for DELETE ... USING
Date: 2026-02-28 14:37:41
Message-ID: CAHGQGwEQGpM8Gi+cgwG0o8xqak8Zy4z7rPSXkX09h4y5VeCw3A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Feb 28, 2026 at 1:38 PM Tatsuya Kawata
<kawatatatsuya0913(at)gmail(dot)com> wrote:
>
> Hi Fujii-san, Soumya-san,
>
> Thank you very much for reviewing and testing my patch!
>
> > Should this use Query_for_list_of_selectables instead of
> > Query_for_list_of_tables? The USING clause can reference not only tables
> > but also views and other selectable objects. The documentation also says
> > that USING follows the same syntax as the FROM clause of a SELECT.
>
> You're absolutely right. Since the USING clause follows the same syntax as the FROM clause of a SELECT statement,
> it should support views and other selectable objects, not just tables.
> I've changed it to use Query_for_list_of_selectables.
>
> > Since multiple objects can follow USING, showing only AS and WHERE immediately
> > after USING <table> feels a bit odd. Also, if we want to support this
> > completion here, shouldn't RETURNING also be included?
> > That said, since tab-completion for SELECT ... FROM ... does not suggest
> > anything at that point, I would also be fine with not suggesting anything for
> > DELETE ... USING ....
>
> I agree with your second point. For consistency with SELECT ... FROM ... completion behavior,
> I think it's better not to suggest anything after USING <table>. This approach is cleaner
> and more consistent with existing patterns.
>
> I've prepared a v4 patch with the following changes:
> - Use Query_for_list_of_selectables instead of Query_for_list_of_tables
> - Remove the completion for USING <table> to maintain consistency with SELECT behavior
>
> The updated v4 patch is attached.

Thanks for updating the patch!

+ /* Complete DELETE FROM <table> USING with a list of selectables */

Would it be better to use "relations supporting SELECT" instead of
"selectables"? That wording is used in other tab-completion comments that
reference Query_for_list_of_selectables, so it might be better to stay
consistent.

As for the regression test, I agree with Kirill. I don't think it's necessary
to add a separate test for this specific tab-completion case. The existing
tests already cover tab-completion patterns based on
Query_for_list_of_selectables following specific keywords, which should be
sufficient.

Regards,

--
Fujii Masao

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2026-02-28 14:59:36 Re: Show comments in \dRp+, \dRs+, and \dX+ psql meta-commands
Previous Message vignesh C 2026-02-28 14:07:14 Re: Skipping schema changes in publication