create or replace function count_app_users() returns table ( total bigint ) language plpgsql as $$ begin return query ( select count(*) from app_user ); end; $$;