hello, I'm new to PostgreSQL, is there a way to tr...
# sql
s
hello, I'm new to PostgreSQL, is there a way to trigger a delete on
public.users
when a user is deleted manually in
auth.users
? I created a trigger on auth.users after a user is deleted and called this function, but it's not working
Copy code
begin
  delete from public.users where id = auth.uid();
  return auth.uid();
end;
Also on the same note, is it me or this process of syncing auth.users with public.users is pretty cumbersome? You have to create a public.users table to if you want to check if an email is already registered, because you cannot query auth.users directly, so you have to create a trigger for that. For every sync between these table a trigger is required. Am I missing something? It seems that instead of helping with the streamlining the users auth handling, you have to start spending a lot of time looking for these kind of solutions for these type of issues.