Hi team,
I hope you're doing well. I'm currently working on integrating Supabase into my Android application. So far, I've successfully integrated the Supabase Auth SDK, and authentication is working smoothly.
However, I'm facing a blocker when it comes to inserting or updating data in the Supabase database using the PostgREST API from the Android client. Specifically, I am encountering errors related to Row-Level Security (RLS) policies, and in some cases, I’ve also received a duplicate key value violates unique constraint error when inserting records into the call_logs table.
I have thoroughly reviewed the policies set up on the Supabase Dashboard and also verified the foreign key relationships — particularly between call_logs.user_id and user_profiles.id. Still, I suspect there may be an issue with how the RLS policies are defined or how Supabase attempts to recursively validate access through foreign key relations, possibly leading to the "infinite recursion" issue as mentioned in the documentation.
I’ve attached multiple screenshots of my policy configurations and errors I encountered. I would really appreciate it if someone from the team could take a look and guide me on:
How to correctly define RLS policies for user_profiles and call_logs to allow users to insert and view only their own data.
Whether it’s better to fetch relational data separately rather than using joins via select=,user_profiles() in this scenario.
How to ensure UUIDs are correctly generated on the client side to avoid primary key conflicts when inserting new rows.
If any additional Supabase or SDK configurations are required to make data operations consistent and secure.
Thank you in advance for your support. I'm happy to provide any additional context or code if needed.
Best regards,
Alish Kumar