User Tools

Site Tools


postgresql:basic_postgre_sql_querys

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
basic_postgre_sql_querys [2017/08/11 10:34] dodgerpostgresql:basic_postgre_sql_querys [2018/04/17 08:45] – ↷ Page moved from basic_postgre_sql_querys to postgresql:basic_postgre_sql_querys dodger
Line 127: Line 127:
 </code> </code>
  
 +<code sql> 
 +SELECT c.relname, np.nspname, u.usename, c.relkind 
 +FROM pg_class c, 
 +    pg_user u, 
 +    pg_namespace np 
 +WHERE u.usesysid=c.relowner 
 +AND np.oid= c.relnamespace 
 +AND c.relkind IN ('r', 'v'
 +
 +</code>
 ===== list columns in table ===== ===== list columns in table =====
  
Line 175: Line 184:
 SELECT * FROM information_schema.role_table_grants where grantee not in ('postgres', 'PUBLIC' ) ; SELECT * FROM information_schema.role_table_grants where grantee not in ('postgres', 'PUBLIC' ) ;
 </code> </code>
 +
 +
 +<code sql>
 +select * from (select grantee, table_schema, table_name, string_agg( privilege_type, ', ' ) from information_schema.role_table_grants WHERE grantee NOT in ( 'postgres', 'PUBLIC' ) group by grantee, table_catalog, table_schema, table_name) t order by table_schema, grantee ;
 +</code>
 +
 +
 ===== Udt grants ===== ===== Udt grants =====
 <code sql> <code sql>