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


6 comments:

  1. Thanks for sharing this information Freyr Energy was founded on the principles of making solar energy affordable and accessible for everyone. In order to make adoption of solar energy a reality at the grass-root level, we have identified that consumer awareness, affordability and accessibility play an integral role. With our innovative platform, SunPro+, our extensive channel-partner network and our efficient service we ensure that these three factors are addressed to make sure your venture into solar energy is hassle-free. Best solar company in Hyderabad-freyr

    ReplyDelete

  2. 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
  3. Thanks for sharing this information KSAC is one of the most trusted multi-specialty Ayurvedic hospitals in India. For over two decades, we provides 100% Evidence based Treatments for diseases, Naturally.Best Ayurveda Hospital in Hyderabad, Bengalore, India

    ReplyDelete
  4. This information is impressive; I am inspired how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic snowflake training

    ReplyDelete
  5. Power BI is a collection of various tools and services, applications that collaborate to produce interactive visuals and business intelligence capabilities of data. It helps end-users very much. Learn Power BI in real-time with ITGuru.
    power bi training | power bi online course

    ReplyDelete