sqlite - 我在 sqlite_sequence 表中丢失了一个表名。我该如何恢复它?

标签 sqlite

似乎当我在 SQLite 管理器下的结构页面上使用“编辑列”命令修改表中的列定义(不是主键列)时,sqlite3 从其 sqlite_sequence 表中删除了该表名。我尝试手动将其添加回去,但发现在添加到丢失的表中时序列号没有得到更新。

有谁知道如何恢复丢失的表名?

最佳答案

sqlite_sequence documentation说:

If the sqlite_sequence.seq value for an AUTOINCREMENT table is manually set to something other than an integer and there is a subsequent attempt to insert the or update the AUTOINCREMENT table, then the behavior is undefined.

但是:

If the sqlite_sequence row for an AUTOINCREMENT table does not exist when the AUTOINCREMENT table is updated, then a new sqlite_sequence row is created.

所以你不应该在 sqlite_sequence 中添加一个“假的”条目,但是如果它存在你可以改变它。

关于sqlite - 我在 sqlite_sequence 表中丢失了一个表名。我该如何恢复它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12495180/

相关文章:

Python:在 sqlite3 或 mysql 中存储字符串列表的正确方法

python - 模型内部的 IntegrityError.Django 中的 DoesNotExist 异常

django - 在数据库中保存模型时过程缓慢

java - 数据库错误: "NullPointerException: Attempt to invoke virtual method getApplicationInfo()... on a null object reference"

android - ContentProvider 数据库未被删除

ios - 使用XCode构建Sqlite ICU

sql - 当我的来源是维恩图时,如何设计数据库表?

表重命名后,sqlite 模式在表名周围有引号

javascript - 使用同步文件夹(dropbox、gdrive、syncthing 等)作为数据库

iPhone iOS 2.0 到 iOS 4.0 SQLite 兼容性