On Fri, Nov 18, 2011 at 05:30:20PM -0800, Yang Zhang scratched on the wall: > I just got bit by some peculiar behavior in sqlite where > > id int primary key > is different from: > id integer primary key > In particular, sqlite will generate values for the latter but not the former:
Well, yes... They're different types. "FLOAT" and "FLOATING POINT" have very different behaviors as well (although not for the reasons you might guess). > I couldn't find in http://www.sqlite.org/autoinc.html To quote: "If a table contains a column of type INTEGER PRIMARY KEY, then that column becomes an alias for the ROWID. [...] When a new row is inserted into an SQLite table, the ROWID can either be specified as part of the INSERT statement or it can be assigned automatically by the database engine." The docs are quite specific that this is a "column of type..." and not just any column with an integer storage class. The phrase INTEGER PRIMARY KEY is also a link, which takes you to a section of the CREATE TABLE docs that includes this: "Other integer type names like "INT" or "BIGINT" or "SHORT INTEGER" or "UNSIGNED INTEGER" causes the primary key column to behave as an ordinary table column..." > or http://www.sqlite.org/datatype3.html any mention of this > peculiardistinguishing behavior. Again, the phrase INTEGER PRIMARY KEY appears on this page as a link to the above information that clearly states the column must be defined as an "INTEGER". You seem to be assuming the defined type "INT" and the type "INTEGER" should be equivalent. > Anyway, if this is intentional (as > I'm guessing), I wouldn't have been able to tell from the docs - > perhaps this would warrant special mention? Almost every use of the phrase "INTEGER PRIMARY KEY" in the documentation is a link that brings you right to this information. It seems like it would be difficult to make this any more accessible without copying the information to several different places on the website, thus bulking up the docs so much people don't bother to read them and making it much more difficult to maintain. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users