Tuesday, January 5, 2021

Query to check owner of each table in Redshift

 

Query to check owner of each table in Redshift

SELECT n.nspname AS schema_name,

       pg_get_userbyid(c.relowner) AS table_owner,

       c.relname AS table_name,

       CASE

         WHEN c.relkind = 'v' THEN 'view'

         ELSE 'table'

       END AS table_type,

       d.description AS table_description

FROM pg_class AS c

  LEFT JOIN pg_namespace n ON n.oid = c.relnamespace

  LEFT JOIN pg_tablespace t ON t.oid = c.reltablespace

  LEFT JOIN pg_description AS d

         ON (d.objoid = c.oid

        AND d.objsubid = 0)

WHERE c.relkind IN ('r','v')

ORDER BY n.nspname,

         c.relname


4 comments:


  1. Our MicroStrategy Training provide you to learn about MicroStrategy products, BI concepts, etc. Our MicroStrategy Online Training also includes live sessions and projects
    microstrategy training online | learn microstrategy online

    ReplyDelete
  2. I just thought it very well may be a point of view to post incase some other individual was having issues confining yet I am truly dangerous in case I am allowed to put names and addresses on here. learn more

    ReplyDelete
  3. SEGA GENESIS - GAN-GAMING
    SEGA GENESIS. GENESIS-HANDS. Genesis sol.edu.kg (JP-EU). NA. https://septcasino.com/review/merit-casino/ NA. 바카라 NA. SEGA GENESIS-HANDS. NA. febcasino.com SEGA GENESIS. NA. GENESIS-HANDS. NA. 출장안마

    ReplyDelete
  4. Thanks for sharing this information. AyurHarsha is the Best Ayurvedic Hospital for Piles Treatment. The Piles Treatment in Ayurvedic Hospital AyurHarsha can be administered with several herbs and oils to cure Piles.

    ReplyDelete