当尝试使用 Supabase 更新我的第一个表时,代码如下:
await db.from("welcome").update({visit_count: newCount});
Run Code Online (Sandbox Code Playgroud)
出现错误:
{
"hint":"To enable updating the table, set REPLICA IDENTITY using ALTER TABLE.",
"details":null,"code":"55000",
"message":"cannot update table \"welcome\" because it does not have a replica identity and publishes updates"
}
Run Code Online (Sandbox Code Playgroud)
在本例中,问题是我创建的welcome表没有主键。
这个错误实际上与 Supabase 没有任何关系,它是与逻辑复制相关的 Postgres 错误: https: //pgdash.io/blog/postgres-replication-gotchas.html
有几个解决方案:
alter table命令将一组特定的列设置为replica identityalter table设为。replica identityfull| 归档时间: |
|
| 查看次数: |
4713 次 |
| 最近记录: |