Tab completion for AT TIME ZONE - Mailing list pgsql-hackers

From Dagfinn Ilmari Mannsåker
Subject Tab completion for AT TIME ZONE
Date
Msg-id 87jzyzsvgv.fsf@wibble.ilmari.org
Whole thread Raw
Responses Re: Tab completion for AT TIME ZONE
Re: Tab completion for AT TIME ZONE
List pgsql-hackers
Hi hackers,

A while back we added support for completing time zone names after SET
TIMEZONE, but we failed to do the same for the AT TIME ZONE operator.
Here's a trivial patch for that.

- ilmari

From 57138e851552a99174d00a0e48ce55ca3170df75 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org>
Date: Wed, 29 Mar 2023 11:16:01 +0100
Subject: [PATCH] psql: tab-complete time zones after AT TIME ZONE

Commit 7fa3db367986160dee2b2b0bbfb61e1a51d486fd added support for
completing time zone names, use that after the AT TIME ZONE operator.
---
 src/bin/psql/tab-complete.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index e38a49e8bd..9bb8ae0dc3 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -4655,6 +4655,10 @@ psql_completion(const char *text, int start, int end)
     else if (TailMatches("JOIN"))
         COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_selectables);
 
+/* ... AT TIME ZONE ... */
+    else if (TailMatches("AT", "TIME", "ZONE"))
+        COMPLETE_WITH_TIMEZONE_NAME();
+
 /* Backslash commands */
 /* TODO:  \dc \dd \dl */
     else if (TailMatchesCS("\\?"))
-- 
2.39.2


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: SQL/JSON revisited
Next
From: "Kumar, Sachin"
Date:
Subject: RE: Initial Schema Sync for Logical Replication