From: Tom Lane <tgl@sss.pgh.pa.us>
To: ladayaroslav@yandex.ru
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15273: Lexer bug with UESCAPE
Date: Tue, 10 Jul 2018 15:50:51 -0400
Message-ID: <23850.1531252251@sss.pgh.pa.us> (raw)
In-Reply-To: <153124291307.1408.15617588871690313363@wrigleys.postgresql.org>
References: <153124291307.1408.15617588871690313363@wrigleys.postgresql.org>
=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> 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
<Unicode character string literal> ::=
[ <introducer> <character set specification> ]
U <ampersand> <quote> [ <Unicode representation>... ] <quote>
[ { <separator> <quote> [ <Unicode representation>... ] <quote> }... ]
<Unicode escape specifier>
<Unicode escape specifier> ::=
[ UESCAPE <quote> <Unicode escape character> <quote> ]
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 <separator> is
between segments of a multiline literal. It looks to me like an
extension that we even allow whitespace around UESCAPE.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, ladayaroslav@yandex.ru
Subject: Re: BUG #15273: Lexer bug with UESCAPE
In-Reply-To: <23850.1531252251@sss.pgh.pa.us>
References: <153124291307.1408.15617588871690313363@wrigleys.postgresql.org> <23850.1531252251@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox