"ON clause references tables to its right"
(1) By anonymous on 2021-02-03 13:39:43 [link] [source]
I have a long SQL statement 1,561 lines long (several SQL statements delimited by ;.
It executes fine in the CLI but not within a programmatic call to sqlite3_exec using C#: it gives the error message in the title.
There is NO 'on' clause.
Any hints as regards the cause of the error would be a great help.
My guess is that this is to do with UTF encoding ... but it is just a guess.
I can't post the script as it would be meaningless without the database and I've no way of sharing the database.
(2) By Richard Hipp (drh) on 2021-02-03 14:06:11 in reply to 1 [source]
It executes fine in the CLI but not within a programmatic call to sqlite3_exec using C#: it gives the error
Are the CLI and your C# application running the same SQLite version? What does "SELECT sqlite_source_id();" say for each?
(4) By anonymous on 2021-02-03 14:17:19 in reply to 2 [link] [source]
What does "SELECT sqlite_source_id();" say for each?
The CLI
sqlite_source_id()
------------------------------------------------------------------------------------
2020-12-01 16:14:00 a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b
C# application
sqlite_source_id()
2020-12-01 16:14:00 a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b
(5) By anonymous on 2021-02-03 21:47:40 in reply to 2 [link] [source]
Is there a limit to the length of the SQL statement that can be used with sqlite3_exec?
(6) By Richard Hipp (drh) on 2021-02-03 22:19:17 in reply to 5 [link] [source]
(3) By anonymous on 2021-02-03 14:09:42 in reply to 1 [link] [source]
Found the error message in sqlite.c lines [145646-145650]
/* ON clause terms may not be used with an index
** on left table of a LEFT JOIN. Ticket #3015 */
if( (prereqAll>>1)>=x ){
sqlite3ErrorMsg(pParse, "ON clause references tables to its right");
return;