For AI agents: the documentation index is at llms.txt. Guide pages have a markdown version at the same path with .md appended, before any query string or fragment.

Swift: Return data after inserting

Perform a SELECT on the query result.

insert(), update(), upsert(), and delete() return no rows by default. Add select() to the chain to get the changed rows back.

Examples

With `upsert()`

struct Instrument: Codable {
  let id: Int
  let name: String
}

let instruments: [Instrument] = try await supabase
  .from("instruments")
  .upsert(Instrument(id: 1, name: "piano"))
  .select()
  .execute()
  .value