Skip to content

Instantly share code, notes, and snippets.

@allipiopereira
Last active April 10, 2024 19:25
Show Gist options
  • Save allipiopereira/75d89757730466ff1bf4ac5b28f06041 to your computer and use it in GitHub Desktop.
Save allipiopereira/75d89757730466ff1bf4ac5b28f06041 to your computer and use it in GitHub Desktop.
create or replace function update_profile () returns trigger security definer language plpgsql as $$
begin
update public.profiles
set email = new.email
where id = new.id;
return new;
end;
$$;
create trigger update_profile_trigger
after
update on auth.users for each row
execute function public.update_profile ();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment