quicksnap
09/09/2021, 12:46 AMnew row violates row-level security policy for table
burggraf
09/09/2021, 1:11 AMinsert()
call.burggraf
09/09/2021, 1:13 AMburggraf
09/09/2021, 1:14 AMBy default, every time you run insert(), the client library will make a select to return the full record. This is convenient, but it can also cause problems if your Policies are not configured to allow the select operation. If you are using Row Level Security and you are encountering problems, try setting the returning param to minimal.
quicksnap
09/09/2021, 1:17 AMburggraf
09/09/2021, 1:21 AMsoedirgo
09/09/2021, 5:40 AMVolkan
09/09/2021, 4:49 PMVolkan
09/09/2021, 4:49 PMburggraf
09/09/2021, 6:44 PMIf you’re using RLS then your user needs to have select access to the data if you want to be able to insert, update, or delete unless you use returning: minimal to override the default behavior.
Miguel
09/10/2021, 10:48 PMThe solution is to add the returning: minimal‘ parameter to your insert()
? Do you have an example by any chance?burggraf
09/10/2021, 10:52 PMconst { data, error } = await supabase
.from('tablename')
.insert([
{
name: 'mark',
age: 123
}
],{returning: 'minimal'});
Miguel
09/10/2021, 10:56 PMburggraf
09/11/2021, 12:34 AMMiguel
09/11/2021, 7:53 AMburggraf
09/11/2021, 1:16 PMselect
) access for that table? That should fix it.acupofjose
09/15/2021, 11:52 PM