Flutter: maxAffected

Sets the maximum number of rows that can be affected by the query. Only effective with PATCH and DELETE operations. Requires PostgREST v13 or higher.

When the limit is exceeded, the query will fail with an error. This provides a safety mechanism to prevent accidentally affecting more rows than intended.

Parameters

Examples

With update()

await supabase
  .from('users')
  .update({'active': false})
  .eq('status', 'inactive')
  .maxAffected(5);

With delete()

await supabase
  .from('users')
  .delete()
  .eq('active', false)
  .maxAffected(10);

With select()

final data = await supabase
  .from('users')
  .update({'status': 'INACTIVE'})
  .eq('id', 1)
  .maxAffected(1)
  .select();