KurDtE <kur...@hotmail.com> wrote:
> I'm getting pretty confused :
> When I execute the query SELECT "GENERAL.ID" FROM VIEW_GENERAL; on
> SQLite Administrator (which uses an older version of SQLite than
> 3.6.10), everything works fine, but when I try the same query with
> SQLite 3.6.10 on command line, I get :
>
> "GENERAL.ID"
> "GENERAL.ID"
> "GENERAL.ID"
> "GENERAL.ID"
> "GENERAL.ID"
>
> meaning that it processes "GENERAL.ID" as text and not as a column
> name ...

VIEW_GENERAL was created something like this:

create view VIEW_GENERAL as
select ID from GENERAL;

Older SQLite versions named the column in the select statement as 
"GENERAL.ID". Newer version just names it ID. If you need a specific 
name for the column, assign it explicitly:

create view VIEW_GENERAL as
select ID as "GENERAL.ID" from GENERAL;


As to interpreting "GENERAL.ID" as a string literal - this is done for 
compatibility with MySQL, if I recall correctly. SQL standard says - 
single quotes for string literals, double quotes for identifiers. SQLite 
instead looks up a double-quoted string as an identifier, but if it 
can't find a suitable one, then it's treated as a string literal. This 
is somewhat unfortunate, but apparently a lot of code out there relies 
on this feature, so it's difficult to remove.

Igor Tandetnik 



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

Reply via email to