From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Sérgio Saquetim <sergiosaquetim(at)gmail(dot)com> |
Cc: | pgsql-docs(at)postgresql(dot)org |
Subject: | Re: Lexical Structure - String Constants |
Date: | 2014-06-17 04:12:34 |
Message-ID: | 814.1402978354@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
=?UTF-8?Q?S=C3=A9rgio_Saquetim?= <sergiosaquetim(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Sérgio Saquetim | 2014-06-17 22:19:29 | Re: Lexical Structure - String Constants |
Previous Message | Sérgio Saquetim | 2014-06-17 03:14:40 | Lexical Structure - String Constants |