小编vk2*_*k26的帖子

如何在 Tarantool 中使用自增索引?

我做了自动增量索引:

box.space.metric:create_index('primary', {
        parts = {{'id', 'unsigned'}},
        sequence = true,
})
Run Code Online (Sandbox Code Playgroud)

然后我尝试在id字段中传递 nil :

metric.id = nil
Run Code Online (Sandbox Code Playgroud)

当我尝试插入这个值时,我发现错误:

Tuple field 1 type does not match one required by operation: expected unsigned
Run Code Online (Sandbox Code Playgroud)

我必须为自动增量字段传递什么值?

第二个问题。如果我使用 tarantool-cluster 的实例很少(例如基于墨盒应用程序),是否证明使用自动增量索引?会不会出现不同实例有重复键的情况?

tarantool

3
推荐指数
1
解决办法
104
查看次数

标签 统计

tarantool ×1