Skip to content

Instantly share code, notes, and snippets.

@ndarilek
Last active July 17, 2018 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ndarilek/ac90452bda84e038a8012efe0b019c84 to your computer and use it in GitHub Desktop.
Save ndarilek/ac90452bda84e038a8012efe0b019c84 to your computer and use it in GitHub Desktop.
create function app.user_email_verified(u app.user) returns boolean as $$
declare
c integer;
begin
select into c count(user_id) from app_private.email_verification_token where user_id = u.id;
if c = 0 then
return true;
else
return false;
end if
end
$$ language sql stable security definer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment