sqlite quoted column name still case non sensitive (feature or bug)
Clash Royale CLAN TAG#URR8PPP
sqlite quoted column name still case non sensitive (feature or bug)
I discovered this:
create table yo ([I] integer, [i] integer)
SQL error 1 : duplicate column name: i
Is this a feature or a bug? I read in the doc that we can quote column name.
I am writing code that is not DB portable (Using SQLITE_
name space everywhere) so is there a non-standard DB option setup that can make sqlite engine case sensitive.
SQLITE_
I know purist will say that having 2 cols with the same name is non sensical, but I have situation where case in column names are derived from languages where case sensitivity makes sense.
Cheers,
Phi.
1 Answer
1
In SQLite, identifiers are never case sensitive, not even when quoted.
For backwards compatibility, this is considered a feature.
If you need to ask, then the effort would be too large for you. :)
– CL.
Sep 25 '15 at 11:01
Sounds the sqlite3AddColumn() ==> STRICMP() could be hacked, if a glob is set (in do_meta() .ident_case_sensitive=1) then sqlite3AddColumn() can do an strcmp(). Don't have time to investgate if that is enough
– Phi
Sep 25 '15 at 11:11
no not enough :) need more work than that :)
– Phi
Sep 25 '15 at 11:16
SQLite identifiers are case sensitive when it comes to non-ASCII identifiers... e.g., there is no problem running the following Cyrillic (with a single letter in either case):
CREATE TABLE yo ([Б] integer, [б] integer)
. See also sqlite.org/faq.html#q18– Brett Zamir
Jan 21 '17 at 1:21
CREATE TABLE yo ([Б] integer, [б] integer)
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Thanx CL for your prompt reply. How much an effort would it be to have an optional option (pragma, meta command?) that break this backward compatibilty, since I start working with sqlite there is no background for me, and turning an option doesn't break past programs? I am not fluent enough to evaluate how much of a works it is to change the "identifier compare" function.
– Phi
Sep 25 '15 at 9:44