Closed apstndb closed 1 year ago
single-line comments seems to have a same problem.
spanner> SELECT 0x1--
-> A;
+----+
| |
+----+
| 26 |
+----+
1 rows in set (0.95 msecs)
spanner> SELECT 0x1#
-> A;
+----+
| |
+----+
| 26 |
+----+
1 rows in set (2.09 msecs)
The statement separator implementation treat comments as empty but it should be treated as a kind of a token separator as like whitespaces. This behavior can make query execution an error or even change the meaning of the query.
Example
spanner-cli evaluate
SELECT 0x1/**/A
asSELECT 0x1A
.Expected behavior
It should be evaluated as
SELECT 0x1 A
(equivalent ofSELECT 0x1 AS A
).Related specification
https://cloud.google.com/spanner/docs/reference/standard-sql/lexical?hl=en