Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qqryu-001SdI-OB for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Oct 2023 09:27:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qqryr-005EP5-E7 for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Oct 2023 09:27:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qqryp-005EL1-Rc for pgsql-hackers@lists.postgresql.org; Thu, 12 Oct 2023 09:27:45 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qqrym-0006FU-SX for pgsql-hackers@postgresql.org; Thu, 12 Oct 2023 09:27:43 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 9D7C0320096C; Thu, 12 Oct 2023 05:27:37 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 12 Oct 2023 05:27:37 -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=fm1; t=1697102857; x=1697189257; bh=5l MvU0rx6C0W0ibbrbJ2/dEXslkALzBhBfgNpWcfCC4=; b=tuoHYVC0U6HMfrD+9A eFoT0MOhxQCt6H+tC8KDZnSIURTQhGX4GcZUYlRgLZ2p/ET+PUTUJWLBOU5EU8Z7 PwSGpDL3dcaQwsy4s7EJem1Oh9wNldaHUN02OLRswuKdabjmpprhngMLaUi8QFJp W4Buko8e2QI/d13lp5LJe7Sc24k/SrsyVsKKekqFfge7PZeygnFXBYybATwKZOnu m3z98syBrudHv4z009zyFK8zvBd8H4W1fdifWUWDwzw7yF3gHW0/OTE50R3QOIHY JrioaAYYsMZfs+U45y8wrYUwfRE01ILVQO370Ge5SE88K1yPl/+yUPiwyIIXfFk/ Yj8A== 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=fm2; t=1697102857; x=1697189257; bh=5lMvU0rx6C0W0 ibbrbJ2/dEXslkALzBhBfgNpWcfCC4=; b=TmHb7jE12c60UCqbcnzDqmUM7SU38 KPa7dw0TfsXf+hNkmlCVKbpA75/OF3BEs8aNEIljflbmf+SzTUpr2klDgFxf1SgV hJ6XKfPHPdHrFvrGBewyASjx1snbKHJ6fv66jtBfPb9F93vfWZaQFqGg+X0ZLknT ehS5wI+P4OeJNnp59LJAAbgP1ICVuL5gqPCVTTNEDDxBvGewwExs6gYkE/8fMhzU ZhucFvjT2eJh16yI9LA1QH1m9ZWD1Gd4JIuccWk+167JM+4zffnehhNXkMbC8oYG XXDytB8lPgv4U/Lhf+r11FhWXpDx3Iu+bVqYrHACQlEuA+8O1Z38tr3+A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedriedtgdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdefhedmnecujfgurhephffvvefufhffjgfkfgggtgesthdtredttder jeenucfhrhhomhepffgrghhfihhnnhcukfhlmhgrrhhiucforghnnhhsnohkvghruceoih hlmhgrrhhisehilhhmrghrihdrohhrgheqnecuggftrfgrthhtvghrnhepkeeljeeufefh ffekhfektdefleeuvdeiiefhheeffeefgeegudffudehjeejiefgnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihhlmhgrrhhisehilhhmrghr ihdrohhrgh X-ME-Proxy: Feedback-ID: i1ff147bf:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 12 Oct 2023 05:27:36 -0400 (EDT) From: =?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= To: Michael Paquier Cc: Jim Jones , 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> <87pm86reuq.fsf@wibble.ilmari.org> Date: Thu, 12 Oct 2023 10:27:34 +0100 In-Reply-To: (Michael Paquier's message of "Thu, 12 Oct 2023 15:49:51 +0900") Message-ID: <87cyxknqbd.fsf@wibble.ilmari.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Michael Paquier writes: > On Fri, Apr 14, 2023 at 12:05:25PM +0200, Jim Jones wrote: >> The patch applies cleanly and it does what it is proposing. - and it's IMHO >> a very nice addition. >> >> I've marked the CF entry as "Ready for Committer". > > +/* ... 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(); > > This style will for the completion of timezone values even if "AT" is > the first word of a query. Shouldn't this be more selective by making > sure that we are at least in the context of a SELECT query? It's valid anywhere an expression is, which is a lot more places than just SELECT queries. Off the top of my head I can think of WITH, INSERT, UPDATE, VALUES, CALL, CREATE TABLE, CREATE INDEX. As I mentioned upthread, the only place in the grammar where the word AT occurs is in AT TIME ZONE, so there's no ambiguity. Also, it doesn't complete time zone names after AT, it completes the literal words TIME ZONE, and you have to then hit tab again to get a list of time zones. If we (or the SQL committee) were to invent more operators that start with the word AT, we can add those to the first if clause above and complete with the appropriate values after each one separately. - ilmari