Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fcyfM-00049l-Qi for pgsql-bugs@arkaria.postgresql.org; Tue, 10 Jul 2018 19:51:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fcyfK-0007QJ-Fn for pgsql-bugs@arkaria.postgresql.org; Tue, 10 Jul 2018 19:51:14 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fcyf2-0005qg-36 for pgsql-bugs@lists.postgresql.org; Tue, 10 Jul 2018 19:50:56 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fcyey-0004zq-9w for pgsql-bugs@lists.postgresql.org; Tue, 10 Jul 2018 19:50:54 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w6AJopJ2023851; Tue, 10 Jul 2018 15:50:51 -0400 From: Tom Lane To: ladayaroslav@yandex.ru cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15273: Lexer bug with UESCAPE In-reply-to: <153124291307.1408.15617588871690313363@wrigleys.postgresql.org> References: <153124291307.1408.15617588871690313363@wrigleys.postgresql.org> Comments: In-reply-to =?utf-8?q?PG_Bug_reporting_form?= message dated "Tue, 10 Jul 2018 17:15:13 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <23849.1531252251.1@sss.pgh.pa.us> Date: Tue, 10 Jul 2018 15:50:51 -0400 Message-ID: <23850.1531252251@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =?utf-8?q?PG_Bug_reporting_form?= writes: > SELECT U&'a' /*c1*/ UESCAPE /*c2*/ 'x'; > ERROR: syntax error at or near "'x'" > LINE 1: SELECT U&'a' /*c1*/ UESCAPE /*c2*/ 'x'; > I think the former is a bug, as, per ISO SQL, a comment is equivalent to > whitespace (with newline), and therefore, should be ignored here. I'd classify this as "won't fix". It'd require pretty significant bloat in the lexer rules to make it happen, and it doesn't really seem worth it. Also, I'm going to push back on the claim that allowing comments there is required by the SQL spec. The relevant rules in SQL:2011 are ::= [ ] U [ ... ] [ { [ ... ] }... ] ::= [ UESCAPE ] I do not see any principled way of arguing that these rules require comments to be allowed adjacent to UESCAPE without also claiming that they must be allowed between, say, the initial 'U' and the ampersand. The only place these rules allow a is between segments of a multiline literal. It looks to me like an extension that we even allow whitespace around UESCAPE. regards, tom lane