Something I noticed today:

sqlite> select * FROM words WHERE word = "id";
<nothing>

sqlite> select * FROM words WHERE word = 'id';
13556|id

sqlite> .schema
CREATE TABLE words (
 id     integer primary key,
 word   varchar(64)
);

Yes, it can be explained: <http://www.sqlite.org/lang_keywords.html> says:

'keyword'  A keyword in single quotes is a string literal.
"keyword"  A keyword in double-quotes is an identifier

So, "id" is interpreted as a column name, not as the string literal 'id',
unless the value in the double quotes is not an identifier (column name).

I think this is quite nasty behaviour. Hope it prevents someone making the
same mistake!

rick

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

Reply via email to