【问题标题】:Cannot update Supabase table because it does not have a replica identity无法更新 Supbase 表,因为它没有副本标识
【发布时间】:2021-03-10 19:02:00
【问题描述】:

尝试使用 Supabase 更新我的第一个表时,代码如下:

await db.from("welcome").update({visit_count: newCount});

出现错误:

{
  "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"
}

【问题讨论】:

    标签: supabase


    【解决方案1】:

    在这种情况下,问题在于我创建了没有主键的 welcome 表。

    这个错误与 Supabase 没有任何关系,它是与逻辑复制有关的 Postgres 错误:https://pgdash.io/blog/postgres-replication-gotchas.html

    有几个解决方案:

    • 确保您有一个主键列
    • 使用alter table 命令将一组特定的列设置为replica identity
    • 使用alter table 命令将replica identity 设置为full

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-09-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-13
      • 2012-11-30
      • 1970-01-01
      • 2023-04-02
      相关资源
      最近更新 更多