【发布时间】:2022-01-15 04:35:26
【问题描述】:
我正在尝试按照this page 为require a datatype on every table column and enforce those types. 启用严格模式。
$ sqlite3 ./a_new_database.sqlite
SQLite version 3.31.1 2020-01-27 19:55:54
Enter ".help" for usage hints.
sqlite> PRAGMA strict=ON;
sqlite> CREATE TABLE yay ( col1 TEXT, col2 INT );
sqlite> INSERT INTO yay ( col1, col2 ) VALUES ("this works", "this is the wrong type");
sqlite> SELECT * from yay;
this works|this is the wrong type
sqlite>
$
我不仅可以INSERT 错误的数据类型。我也可以SELECT它。
我试过PRAGMA strict=ON; 和PRAGMA strict=1;。两者都不起作用。我想我没有正确启用严格模式。
如何正确启用严格模式?
【问题讨论】:
-
This page is intended to collect ideas for new error conditions that would be enforced in strict mode, assuming that strict mode is someday implemented.。换句话说,这实际上从未发生过