On 18 May 2014, at 3:32pm, Baruch Burstein <bmburst...@gmail.com> wrote:

> Sqlite is case-insensitive as far as table/column/db names. Is this
> documented as official behavior or it may change?

I would like to expand the scope of this question because I think an answer to 
just what Baruch asked may be over-specific.  According to the standards SQL is 
case insensitive for identifiers unless they're quoted.  So theoretically

CREATE TABLE mixedCaseTableName (id INTEGER)

SELECT * FROM mixedCaseTableName;
SELECT * FROM MIXEDCASETABLENAME

both succeed but

SELECT * FROM "mixedCaseTableName";
SELECT * FROM "MIXEDCASETABLENAME"

both fail.  Unfortunately

SELECT * FROM [mixedCaseTableName];
SELECT * FROM [MIXEDCASETABLENAME]

work differently in different implementations.  However my understanding is 
that technically [] should act the same as "".

But there's an exception.  If you quote the identifier when you create it you 
'fix' the case and you have to use that case whenever you use to it.  And in 
some cases you have to quote the identifier whenever you use it.  In other words

CREATE TABLE "quotedTableName" (id INTEGER);
SELECT * FROM quotedTableName

should fail if you accord directly to the standard.  However, most 
implementations will not make it fail.  Some ignore the quotes on the CREATE 
command, others ignore them when doing the SELECT.

All the above applies to all identifiers, I just used table names in my 
examples.

I hope now that someone familiar with SQLite specifically will post about this.

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

Reply via email to