mercredi 12 août 2015

Why didn't SQLite3 fail when using an invalid datatype

I created a table as in a tutorial on sitepoint.com

CREATE TABLE comments ( 
post_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 
name TEXT NOT NULL, 
email TEXT NOT NULL, 
website TEXT NULL, 
comment TEXT NOT NULL );

Then I tried adding a column

ALTER TABLE comments
INSERT COLUMN enabled BOOL

Then I realized that there is no BOOL type in SQLite. But the entry was added

sqlite> .schema comments
CREATE TABLE comments (
post_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
email TEXT NOT NULL,
website TEXT NOT NULL,
comment TEXT NOT NULL , enabled BOOL);

Why didn't SQLite oppose?

Aucun commentaire:

Enregistrer un commentaire