创建索引后重命名SQLite表/列/行

前端之家收集整理的这篇文章主要介绍了创建索引后重命名SQLite表/列/行前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如果我在创建索引后重命名sqlite Tables / Columns / Rows,旧索引是否仍然可用?

谢谢!

解决方法

如果您正在使用ALTER TABLE和RENAME TO重命名表,那么如 this page(来自sqlite文档)所述,索引仍然有效:

The ALTER TABLE command in sqlite allows the user to rename a table […] If the table being renamed has triggers or indices,then these remain attached to the table after it has been renamed.

但请注意,不允许重命名列.这是SQL features not implemented by sqlite之一:

Only the RENAME TABLE and ADD COLUMN variants of the ALTER TABLE command are supported. Other kinds of ALTER TABLE operations such as DROP COLUMN,ALTER COLUMN,ADD CONSTRAINT,and so forth are omitted.

行没有名称(除了具有PK的意义)因此没有真正的重命名方式.

猜你在找的Sqlite相关文章