1select n.nspname as rule_schema,
2 c.relname as rule_table,
3 case r.ev_type
4 when '1' then 'SELECT'
5 when '2' then 'UPDATE'
6 when '3' then 'INSERT'
7 when '4' then 'DELETE'
8 else 'UNKNOWN'
9 end as rule_event
10from pg_rewrite r
11 join pg_class c on r.ev_class = c.oid
12 left join pg_namespace n on n.oid = c.relnamespace
13 left join pg_description d on r.oid = d.objoid