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 1r7zzw-007lh1-QV for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Nov 2023 15:27:40 +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 1r7zzv-005mHD-59 for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Nov 2023 15:27:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r7zzu-005mH5-Rc for pgsql-hackers@lists.postgresql.org; Tue, 28 Nov 2023 15:27:38 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r7zzm-008zV5-O3 for pgsql-hackers@postgresql.org; Tue, 28 Nov 2023 15:27:37 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 3ASFRQeN4146715; Tue, 28 Nov 2023 10:27:26 -0500 From: Tom Lane To: Andrew Dunstan cc: Alvaro Herrera , Bruce Momjian , Shay Rojansky , pgsql-hackers Subject: Re: Missing docs on AT TIME ZONE precedence? In-reply-to: <9df52975-686d-c945-36bd-559c930f2dc7@dunslane.net> References: <202311271732.hn567fcmvy37@alvherre.pgsql> <4006949.1701117264@sss.pgh.pa.us> <9df52975-686d-c945-36bd-559c930f2dc7@dunslane.net> Comments: In-reply-to Andrew Dunstan message dated "Mon, 27 Nov 2023 16:09:10 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4146713.1701185246.1@sss.pgh.pa.us> Date: Tue, 28 Nov 2023 10:27:26 -0500 Message-ID: <4146714.1701185246@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andrew Dunstan writes: > Looks good. Perhaps the comments above the UNBOUNDED precedence setting > (esp. the first paragraph) need strengthening, with a stern injunction > to avoid different precedence for non-reserved keywords if at all possible. OK. How about rewriting that first para like this? * Sometimes it is necessary to assign precedence to keywords that are not * really part of the operator hierarchy, in order to resolve grammar * ambiguities. It's best to avoid doing so whenever possible, because such * assignments have global effect and may hide ambiguities besides the one * you intended to solve. (Attaching a precedence to a single rule with * %prec is far safer and should be preferred.) If you must give precedence * to a new keyword, try very hard to give it the same precedence as IDENT. * If the keyword has IDENT's precedence then it clearly acts the same as * non-keywords and other similar keywords, thus reducing the risk of * unexpected precedence effects. * * We used to need to assign IDENT an explicit precedence just less than Op, * to support target_el without AS. While that's not really necessary since * we removed postfix operators, we continue to do so because it provides a * reference point for a precedence level that we can assign to other * keywords that lack a natural precedence level. regards, tom lane