3

When trying to my first table update using Supabase, with code like:

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

Got error:

{
  "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"
}
Shorn
  • 19,077
  • 15
  • 90
  • 168

1 Answers1

5

In this instance, the problem was that I had created the welcome table without a primary key.

This error is not really anything to do with Supabase, it's a Postgres error relating to logical replication: https://pgdash.io/blog/postgres-replication-gotchas.html

There's a couple of solutions:

  • make sure you have a primary key column
  • use the alter table command to set a specific set of columns as replica identity
  • use the alter table command to set the replica identity to full.
Shorn
  • 19,077
  • 15
  • 90
  • 168