On 26 Jan 2017, at 10:56pm, Michael Falconer <michael.j.falco...@gmail.com> 
wrote:

> as I see it there is no problem here. Explicit quoting regardless, the
> column does not exist and an error is returned, isn't this the expected
> outcome?

Yet it’s not consistent.  I should have given more examples, so here they are.  
I can do this:

SQLite version 3.16.0 2016-11-04 19:09:39
Enter ".help" for usage hints.
sqlite> CREATE TABLE reports (a INT, b TEXT);
sqlite> CREATE INDEX index_reports_addition ON reports (1 + 2);
sqlite> PRAGMA index_xinfo(index_reports_addition);
0|-2||0|BINARY|1
1|-1||0|BINARY|0

which is an index based on a constant numeric expression, so that works.  I can 
do this:

sqlite> CREATE INDEX index_reports_string ON reports ('a' + b + 'c');
sqlite> PRAGMA index_xinfo(index_reports_string);
0|-2||0|BINARY|1
1|-1||0|BINARY|0

but I cannot do this:

sqlite> CREATE INDEX index_reports_3strings ON reports ('a',b,'c');
Error: no such column: c

Why is it objecting to 'c' here and not 'a' ?  If I remove the 'c' I get

sqlite> CREATE INDEX index_reports_2strings ON reports ('a',b);
sqlite> PRAGMA index_xinfo(index_reports_2strings);
0|0|a|0|BINARY|1
1|1|b|0|BINARY|1
2|-1||0|BINARY|0
sqlite> CREATE INDEX index_reports_1string ON reports ('a');
sqlite> PRAGMA index_xinfo(index_reports_1string);
0|0|a|0|BINARY|1
1|-1||0|BINARY|0

so it seems there’s no problem with the 'a'.  So why is it objecting to the 'c' 
?

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to