© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
24 replies
\n

Failing to insert due to policy?

-- create teams table
create table teams (
  id bigint generated by default as identity primary key,
  creator uuid references users not null default auth.uid(),
  title text default 'Untitled',
  created_at timestamp with time zone default timezone('utc'::text, now()) not null
);

-- teams row level security
alter table teams enable row level security;

-- policies
create policy "Users can create teams" on teams for 
  insert to authenticated with check (true);
-- create teams table
create table teams (
  id bigint generated by default as identity primary key,
  creator uuid references users not null default auth.uid(),
  title text default 'Untitled',
  created_at timestamp with time zone default timezone('utc'::text, now()) not null
);

-- teams row level security
alter table teams enable row level security;

-- policies
create policy "Users can create teams" on teams for 
  insert to authenticated with check (true);


  const createTeam = (title: string) =>
    supabase
      .from('teams')
      .insert({ title });
  const createTeam = (title: string) =>
    supabase
      .from('teams')
      .insert({ title });


Is returning
code: "42501"
details: null
hint: null
message: "new row violates row-level security policy for table \"teams\""
code: "42501"
details: null
hint: null
message: "new row violates row-level security policy for table \"teams\""
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

RLS - Help with Insert Policy
SupabaseSSupabase / help-and-questions
4y ago
Access insert values from policy
SupabaseSSupabase / help-and-questions
4y ago
RLS insert still failing for anon role even with correct policy
SupabaseSSupabase / help-and-questions
6mo ago
.insert().select() doesnt work due to rls
SupabaseSSupabase / help-and-questions
4mo ago