0

As I am creating a repository of the project, I need all the "create statements" of every table in a particular schema. I have tried using:

SELECT *
FROM pg_table_def
WHERE schemaname = 'public'
ORDER BY tablename;

But this doesn't suffice as it does not give me the create statement.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
AshishETL
  • 9
  • 1
  • The question is not a duplicate since it the other question only refers to pulling the DDLs from Postgres and not Redshift. – mike_pdb Dec 29 '15 at 00:19
  • To get the DDLs, you can use this view and select based on "schemaname" https://github.com/awslabs/amazon-redshift-utils/blob/master/src/AdminViews/v_generate_tbl_ddl.sql. The only thing it doesn't give you is permissions which can be found here http://stackoverflow.com/questions/22523273/how-to-find-out-what-are-the-privileges-granted-to-one-group-in-redshift/22523393#22523393 – mike_pdb Dec 29 '15 at 00:21

0 Answers0