Re: Lexical Structure - String Constants

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Lexical Structure - String Constants
Дата
Msg-id 814.1402978354@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Lexical Structure - String Constants  (Sérgio Saquetim <sergiosaquetim@gmail.com>)
Ответы Re: Lexical Structure - String Constants
Список pgsql-docs
=?UTF-8?Q?S=C3=A9rgio_Saquetim?= <sergiosaquetim@gmail.com> writes:
> So line style comments (--) are accepted between segments but not C style
> block comments (/* */). Do you think this difference in behavior should me
> mentioned in the docs?

Hm, interesting.  It looks to me like modern versions of the SQL spec
require either -- or /* ... */ style comments to be allowed between
segments of a quoted literal.  This is pretty bad taste in language
design, if you ask me, but that's what it seems to say.  I think that
our current lexer rules date from before the SQL standard even had
/* ... */ style comments, which is why the lexer isn't taking it.

> I've also noticed that in section 4.1.2.6, the following statement: "At
> least one digit must follow the exponent marker (e), if one is present."

> As I've understood the statement, I think it says that the following
> instruction should not be valid because the exponent marker is not followed
> by at least one digit, but the expression is successfully evaluated:

> postgres=# SELECT 10e;
>  e
> ----
>  10
> (1 row)

"10e" is not a valid number, just like the manual says.  But "10" is a
valid number, and "e" is a valid column alias, so this is equivalent
to "SELECT 10 AS e".  There's no requirement for white space between
adjacent tokens, if the tokens couldn't validly be run together into
one token.

            regards, tom lane


В списке pgsql-docs по дате отправления:

Предыдущее
От: Sérgio Saquetim
Дата:
Сообщение: Lexical Structure - String Constants
Следующее
От: Sérgio Saquetim
Дата:
Сообщение: Re: Lexical Structure - String Constants