With this query you essentially ask the RDBMS to evaluate and supply you with the result of (X and 0) - my guess is the optimiser
pounces directly on the fact that (X and 0) will always be 0 no matter what X is so that it does not bother trying to evaluate X
which means it never has the need to resolve the name and so never needs to raise the error.
It's like if I ask you to deliver me a zamooki... you may need to report back
that you haven't the faintest clue what it is...
But if I ask you to NOT deliver me a zamooki, you could just say "DONE!" and go
on with your life without a bother.
That said, the standard requires every specified value to be evaluatable, whether or not it needs to be... but it takes extra CPU
cycles to determine this and if it is not needed, SQLite does not bother to waste the resource simply to check whether you are
asking sane questions.
Feature or bug? a bit of both maybe. To adequately describe this sort of
happenstance, I propose the word: Fug.
Cheers!
Ryan
On 2013/12/20 01:11, Zsbán Ambrus wrote:
Why does the following select statement succeed, instead of giving a
"no column error"? Is this a feature or a bug?
sqlite> select nonsensename and 0;
0
sqlite> .version
SQLite 3.8.1 2013-10-17 12:57:35 c78be6d786c19073b3a6730dfe3fb1be54f5657a
The select statement is not a subquery and has no from clause, so
nonsensename is a column that should not exist and so should give an
error in my opinion.
Ambrus
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users