psql list rules

Solutions on MaxInterview for psql list rules by the best coders in the world

showing results for - "psql list rules"
Cristóbal
16 Jan 2017
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 ;