Perform a DELETE on the table or view.
delete()
should always be combined with a filter block to target the item(s) you wish to delete.delete()
with filters and you have RLS enabled, only rows visible through SELECT
policies are deleted. Note that by default no rows are visible, so you need at least one SELECT
/ALL
policy that makes the rows visible.delete
will not return the deleted data. If you want to return the deleted data, you can use the select()
method inside the request.Additional configuration & filtering for the request.
supabase.from("cities").delete \{
filter \{
City::id eq 666
//or
eq("id", 666)
\}
\}
val deletedCity = supabase.from("cities").delete \{
select()
filter \{
City::id eq 666
//or
eq("id", 666)
\}
\}.decodeSingle<City>()