I have two tables in my Supabase DB, called users
and tweets
. I’ve created a new role called external_user_twitter_data
with “user can sign in” permission.
Then, I’m trying to create a policy for my tables. I need all kind of access to the tables for the given users: read, write, update, etc.
So, this is the query I’m trying to create the policy with:
create policy "Read-Write Twitter users for external users"
on "public"."users"
as PERMISSIVE
for ALL
to external_user_twitter_data
using (
(select auth.uid()) = user_id
)
with check (
(select auth.uid()) = user_id
);
as described in the documentation here.
But I’m getting an error: ERROR: column "user_id" does not exist
I understand that probably I should add a value there.
Does that mean I need to create a Supabase user and put the user ID instead of user_id
?
Also, see the screenshot below of how I’m trying to do it in the Supabase admin dashboard.