progNewbie
progNewbie

Reputation: 4832

Supabase `UPDATE requires a WHERE clause`

I try to update a state of some rows in my table game. My table has a foreignkey lobby to the lobby table, that has a name and a hash.

I try the following in TypeScript:

supabaseClient
    .from("game")
    .update({ state: closedGameState })
    .eq("lobby.name", lobbyName)
    .eq("lobby.hash", lobbyHash)
    .select("lobby(name, hash)");

But I get this error message:

{
  error: {
    code: "21000",
    details: null,
    hint: null,
    message: "UPDATE requires a WHERE clause"
  },
  data: null,
  count: null,
  status: 400,
  statusText: "Bad Request"
}

I am setting two where-clauses. So what am I doing wrong here? Thanks!

Upvotes: 1

Views: 673

Answers (1)

cgenco
cgenco

Reputation: 3557

I had a supabase update that was failing with more than one row returned by a subquery used as an expression and the problem was a row-level security (RLS) policy.

Upvotes: -1

Related Questions