Press ⌘J or click me!
1.GRANT SELECT ON TABLE auth.users TO service_role;
1.CREATE OR REPLACE FUNCTION get_total_amount_of_users()2.RETURNS TABLE (total_users bigint)3.AS $$4.BEGIN5.RETURN QUERY SELECT COUNT(id) FROM auth.users;6.END;7.$$ LANGUAGE plpgsql;
1.CREATE OR REPLACE FUNCTION get_user_id_by_email(email TEXT)2.RETURNS TABLE (id uuid)3.AS $$4.BEGIN5.RETURN QUERY SELECT au.id FROM auth.users au WHERE au.email = $1;6.END;7.$$ LANGUAGE plpgsql;