-- Diagnóstico de leitura. Não altera tabelas, permissões, fila ou histórico. -- Execute no SQL Editor do projeto exclusivo do robô e compartilhe o resultado. with expected(name) as ( values ('robot_settings'),('robot_properties'),('robot_contacts'),('robot_suppressions'), ('robot_batches'),('robot_executors'),('robot_items'),('robot_sent'),('robot_events'),('robot_sync'),('robot_kenlo_pages') ) select e.name as tabela, c.oid is not null as existe, c.relrowsecurity as rls_ativo, case when c.oid is not null then has_table_privilege('service_role',c.oid,'SELECT') and has_table_privilege('service_role',c.oid,'INSERT') and has_table_privilege('service_role',c.oid,'UPDATE') and has_table_privilege('service_role',c.oid,'DELETE') end as backend_tem_acesso, case when c.oid is not null then has_table_privilege('anon',c.oid,'SELECT,INSERT,UPDATE,DELETE') end as anon_tem_acesso from expected e left join pg_namespace n on n.nspname='public' left join pg_class c on c.relnamespace=n.oid and c.relname=e.name order by e.name; with expected(signature) as (values ('public.robot_mutate(text,jsonb)'),('public.robot_snapshot(integer,text)'), ('public.robot_wait_kenlo_item(jsonb)'),('public.robot_claim_economical_item(jsonb)'),('public.robot_prepare_economical_item(jsonb)'),('public.robot_snapshot_economy(integer,text)')) select signature as funcao, to_regprocedure(signature) is not null as existe, case when to_regprocedure(signature) is not null then has_function_privilege('service_role',to_regprocedure(signature),'EXECUTE') end as backend_pode_executar, case when to_regprocedure(signature) is not null then has_function_privilege('anon',to_regprocedure(signature),'EXECUTE') end as anon_pode_executar from expected;