Skip to main content
Version: v2 RC

Delete data: delete()

Perform a DELETE on the table or view.

By default, deleted rows are not returned. To return it, chain the call with .select() after filters.

const { error } = await supabase
.from('countries')
.delete()
.eq('id', 1)

Parameters

  • optionsrequiredobject

    Named parameters

      Properties
    • countoptionalexact | planned | estimated

      Count algorithm to use to count deleted rows.

      "exact": Exact but slow count algorithm. Performs a COUNT(*) under the hood.

      "planned": Approximated but fast count algorithm. Uses the Postgres statistics under the hood.

      "estimated": Uses exact count for low numbers and planned count for high numbers.

        Properties
      • estimatedrequiredliteral

        No description provided.

      • plannedrequiredliteral

        No description provided.

      • exactrequiredliteral

        No description provided.

Notes

  • delete() should always be combined with filters to target the item(s) you wish to delete.
  • If you use 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.

Examples

Delete records

const { error } = await supabase
.from('countries')
.delete()
.eq('id', 1)
const { data, error } = await supabase
.from('countries')
.select()