इस क्वेरी (विशिष्ट डेटाबेस, स्कीमा, या तालिकाओं के लिए फिल्टर करने के लिए लाइन (रों) WHERE
खंड में टिप्पणी हटाएं) डेटाबेस और स्कीमा के सभी में तालिकाओं के सभी सूची जाएगा, विशेषाधिकारों के साथ में दिखाया गया है आदेश इतना है कि यह अगर एक विशिष्ट विशेषाधिकार प्रदान किया जाता है देखना आसान है या नहीं:
SELECT grantee
,table_catalog
,table_schema
,table_name
,string_agg(privilege_type, ', ' ORDER BY privilege_type) AS privileges
FROM information_schema.role_table_grants
WHERE grantee != 'postgres'
-- and table_catalog = 'somedatabase' /* uncomment line to filter database */
-- and table_schema = 'someschema' /* uncomment line to filter schema */
-- and table_name = 'sometable' /* uncomment line to filter table */
GROUP BY 1, 2, 3, 4;
नमूना उत्पादन:
grantee |table_catalog |table_schema |table_name |privileges |
--------|----------------|--------------|---------------|---------------|
PUBLIC |adventure_works |pg_catalog |pg_sequence |SELECT |
PUBLIC |adventure_works |pg_catalog |pg_sequences |SELECT |
PUBLIC |adventure_works |pg_catalog |pg_settings |SELECT, UPDATE |
...
आप एसक्यूएल फलक या स्नातकोत्तर कमांड लाइन से सीधे इस चलाने होगा? –
@ डैनियलएल। वैनडेन बॉश: सभी मेटा-कमांड, जैसे \ \ z', psql के लिए हैं। और psql PostgreSQL के लिए कमांड लाइन इंटरफ़ेस है। –