On 27 Jun 2018, at 11:56pm, Mark Wagner <m...@google.com> wrote: > I recently pointed out that sqlite doesn't enforce type names and > constraints when creating tables but I was unable to explain/justify this > behavior. I'm sure this has come up before and there's a clear answer but > I didn't find it easily.
The usual answer for these things is backward compatiibility. The bug existed for so long before it was spotted that SQLite3 must continue to support it. Roll on SQLite4. > For example this is accepted without error: CREATE TABLE bar2 (x happy > days); You can analyse what's actually happening: SQLite version 3.22.0 2017-12-05 15:00:17 sqlite> CREATE TABLE bar2 (x happy days); sqlite> .headers on sqlite> .mode column sqlite> PRAGMA table_info(bar2); cid name type notnull dflt_value pk ---------- ---------- ---------- ---------- ---------- ---------- 0 x happy days 0 0 The interpretation is that the first two words are a columnname and type, and the third word is a column ID, which is not useful. And there's some sort of formatting bug in the CLI. :-( So don't do that. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users