From c53de01f1b821e4b8d75a489971ca01c9f539d7b Mon Sep 17 00:00:00 2001 From: TatsuyaKawata Date: Sun, 1 Mar 2026 14:39:06 +0900 Subject: [PATCH v5] Add tab completion for DELETE ... USING This implements the tab completion that was marked as XXX TODO in the source code. The following completion is now supported: - DELETE FROM USING -> list of selectables This uses Query_for_list_of_selectables (instead of Query_for_list_of_tables) because the USING clause can reference not only tables but also views and other selectable objects, following the same syntax as the FROM clause of a SELECT statement. Author: Tatsuya Kawata Reviewed-by: Chao Li Reviewed-by: Kirill Reshke Reviewed-by: Soumya S Murali Reviewed-by: Fujii Masao Discussion: https://www.postgresql.org/message-id/flat/CAHza6qf0CLJuJr+5cQw0oWNebM5VyMB-ghoKBgnEjOQ_JtAiuw@mail.gmail.com --- src/bin/psql/tab-complete.in.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c index b2dba6d10ab..43451fce1c3 100644 --- a/src/bin/psql/tab-complete.in.c +++ b/src/bin/psql/tab-complete.in.c @@ -4266,7 +4266,9 @@ match_previous_words(int pattern_id, /* Complete DELETE FROM
*/ else if (TailMatches("DELETE", "FROM", MatchAny)) COMPLETE_WITH("USING", "WHERE"); - /* XXX: implement tab completion for DELETE ... USING */ + /* Complete DELETE FROM
USING with relations supporting SELECT */ + else if (TailMatches("DELETE", "FROM", MatchAny, "USING")) + COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_selectables); /* DISCARD */ else if (Matches("DISCARD")) -- 2.34.1