Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pnFkq-0007fC-KK for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Apr 2023 09:30:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pnFko-000237-VZ for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Apr 2023 09:30:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pnFko-00022h-7N for pgsql-hackers@lists.postgresql.org; Fri, 14 Apr 2023 09:30:02 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pnFki-002pCO-PQ for pgsql-hackers@postgresql.org; Fri, 14 Apr 2023 09:30:01 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 4CEC932009FA; Fri, 14 Apr 2023 05:29:53 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 14 Apr 2023 05:29:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilmari.org; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1681464592; x=1681550992; bh=lI eEbrPPzISqtmwcj+U3Z3jbSZ/eQLcYzFrWKJaSv+M=; b=GLSL3NSavOyOepbCZZ bwtgt7bG2yoWDYg/UXfrCzFncNcLdlAT5DFeaWaY1JOlBhs9nqtZFl+hMG8SCqWj PIl8s/BHJYVanrai6zoMyP/djkKst17t56wer52dJccchC4qixPbxSagYjqCrSA8 CoQbY+kh+mKz/7Y/P5d/VV6Ng8mLVi1lA0/jNDYvDhLziitT06dZHfzlOQSVWIpK ZoelO9UjPJ5XhLs0ZB8ypV8CRncW0++o/aYYdA7to4jm4rtRf+0dhTOBl0Hn+bKX RRVrahExVj9ibllZVW1yAF5Uq18LIdYFIvhEfSsBC+7vUtE543vSFNRwfPIzjQwv BIhw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1681464592; x=1681550992; bh=lIeEbrPPzISqt mwcj+U3Z3jbSZ/eQLcYzFrWKJaSv+M=; b=QFP61zkeDNLapjnpPnVaU0jw2LG6R qgIEx30sboPWer+1tTRZZJwKnHDGn0Cj3LYVEZLCcBiNipdhBvFvr/G0POOxcpGy /IgNC2pAJT/1DhpNmd14jDPgRTgUrZRNznAgSjhG2C9iAyWDFJr+eedqXFQs2T9p gFhTEoU2KEmxbtZoB3LkyCOfIdLqQ4ALGqEaq/VQifP1Br4ZFgD+BC5cuTSblJuS Cp59L7slpmxVZtyOVuwmP3KpbX/DHoO7JyE0IMkVbZo+Nvy35i4WKmjs5iKQ85be tzU0ausJF/qrt1lFODdGoxwTA/OTbSsm05xPdktuEAp31IaDT/wRIukFQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeltddgudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufhffjgfkfgggtgesmhdtreertderjeenucfhrhhomhepffgrghhf ihhnnhcukfhlmhgrrhhiucforghnnhhsnohkvghruceoihhlmhgrrhhisehilhhmrghrih drohhrgheqnecuggftrfgrthhtvghrnhepvddvhfehtdefkedugfetudefhefggfegjeei jeehuefgteehgfegtdelgeetteejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomhepihhlmhgrrhhisehilhhmrghrihdrohhrgh X-ME-Proxy: Feedback-ID: i1ff147bf:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 14 Apr 2023 05:29:51 -0400 (EDT) From: =?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= To: Jim Jones Cc: pgsql-hackers@postgresql.org Subject: Re: Tab completion for AT TIME ZONE References: <87jzyzsvgv.fsf@wibble.ilmari.org> <87zg7dq96c.fsf@wibble.ilmari.org> <8f76a2e7-1ea3-76df-3176-887d94ee3aea@uni-muenster.de> Date: Fri, 14 Apr 2023 10:29:49 +0100 In-Reply-To: <8f76a2e7-1ea3-76df-3176-887d94ee3aea@uni-muenster.de> (Jim Jones's message of "Fri, 14 Apr 2023 09:42:05 +0200") Message-ID: <87pm86reuq.fsf@wibble.ilmari.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi Jim, Thanks for having a look at my patch, but please don't top post on PostgreSQL lists. Jim Jones writes: > Hi, > > On 12.04.23 19:53, Dagfinn Ilmari Mannsåker wrote: >> Dagfinn Ilmari Mannsåker writes: >> >>> 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. >> > > Is this supposed to provide tab completion for the AT TIME ZONE operator > like in this query? > > SELECT '2023-04-14 08:00:00' AT TIME ZONE 'Europe/Lisbon'; > > The patch applied cleanly but I'm afraid I cannot reproduce the intended > behaviour: > > postgres=# SELECT '2023-04-14 08:00:00' AT > > postgres=# SELECT '2023-04-14 08:00:00' AT T > > postgres=# SELECT '2023-04-14 08:00:00' AT TIME Z > > Perhaps I'm testing it in the wrong place? It doesn't tab complete the AT TIME ZONE operator itself, just the timezone name after it, so this sholud work: # SELECT now() AT TIME ZONE or # SELECT now() AT TIME ZONE am However, looking more closely at the grammar, the word AT only occurs in AT TIME ZONE, so we could complete the operator itself as well. Updated patch attatched. > Best, Jim - ilmari --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v2-0001-psql-tab-completion-for-AT-TIME-ZONE.patch From 365844db04d27c5bcd1edf8a9d0d44353bc34631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= Date: Wed, 29 Mar 2023 11:16:01 +0100 Subject: [PATCH v2] psql: tab completion for AT TIME ZONE Commit 7fa3db367986160dee2b2b0bbfb61e1a51d486fd added support for completing time zone names, use that after the AT TIME ZONE operator. Also complete the operator itself, since it's the only thing in the grammar starting with AT. --- src/bin/psql/tab-complete.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 5825b2a195..e3870c68e9 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -4657,6 +4657,14 @@ 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")) + COMPLETE_WITH("TIME ZONE"); + else if (TailMatches("AT", "TIME")) + COMPLETE_WITH("ZONE"); + else if (TailMatches("AT", "TIME", "ZONE")) + COMPLETE_WITH_TIMEZONE_NAME(); + /* Backslash commands */ /* TODO: \dc \dd \dl */ else if (TailMatchesCS("\\?")) -- 2.39.2 --=-=-=--