sqlite3 seems to ignore garbage at the end of some statements.
(1.1) Originally by L Carl (lcarlp) with edits by Richard Hipp (drh) on 2020-05-07 17:22:38 from 1.0 [source]
I ran across this by accident:
sqlite> select count(*) from (select * from log); 14479 sqlite> select count(*) from (select * from log)xxxxx; 14479 sqlite> .version SQLite 3.31.1 2020-01-27 19:55:54 3bfa9cc97da10598521b342961df8f5f68c7388fa117345eeb516eaa837bb4d6 zlib version 1.2.11 clang-11.0.0 sqlite>
I expected the xxxxx to throw an error. Based on discussions I’ve found, it’s possible this is a well known problem with SQLite, but I’m new here, and this seems like incorrect behavior to me, albeit not tragic. (I know my query is senseless. My original was more complicated.)
(2) By Richard Hipp (drh) on 2020-05-07 17:29:44 in reply to 1.1 [link] [source]
The 'xxxxx' is a "table-alias". You can see it at the bottom of the "table-or-subquery" syntax diagram shown below, right after the optional AS keyword.
(3) By L Carl (lcarlp) on 2020-05-08 01:01:36 in reply to 2 [link] [source]
Yes. I realized that it would be treated as a table alias when I was explaining the situation to my wife while we were out for a walk.