为什么在列名转义时,SQLite没有正确识别视图的列类型?

时间:2014-08-28 20:41:39

标签: sqlite

CREATE TABLE foo (  this            VARCHAR(64) );
CREATE VIEW far AS SELECT  this            FROM foo;
PRAGMA table_info(far) /* this correctly has VARCHAR(64) as the type */

CREATE TABLE bar ( 'this.is.a.test' VARCHAR(64) );    
CREATE VIEW baz AS SELECT 'this.is.a.test' FROM bar;
PRAGMA table_info(baz) /* this has no type for 'this.is.a.test' */

使用SQLite版本3.8.4.3进行测试

1 个答案:

答案 0 :(得分:0)

SQLite使用dynamic typing。 列类型不限制可以存储在列中的值的类型或长度。

存储列类型是为了与其他数据库兼容,但它们是的属性,而不是列中的,因此无法保证当从表中取出值时(当您直接在表上或通过视图执行查询时),将保留类型信息。

相关问题