4

I'd like to take a dump of schema of redshift and do some comparisons among different environments.

unload('select * from pg_table_def') to 's3://blah/blah/stage.txt' credentials 'aws_access_key_id=XXXXX;aws_secret_access_key=XXXXXX' parallel off allowoverwrite manifest; 

But the code above throws me the following error.

INFO: Function "format_type(oid,integer)" not supported. INFO: Function "pg_table_is_visible(oid)" not supported. ERROR: Specified types or functions (one per INFO message) not supported on Redshift tables. 

Any idea how to make this work ? or is there any way other way to get the schema. i need to know sort key and dist key information as well.

1
  • 1
    I thought about trying to copy the relevant pg_table_def rows to a temp table, and unloading that, but I can't figure out how to copy that leader node table into a temp table either! Commented Sep 12, 2017 at 21:26

1 Answer 1

2

Redshift keeps certain information in special area on the leader node whereas UNLOAD commands are processed on each slice (AFAIK) and therefore can't use leader node only functions.

You would probably need to extract this from an external machine using psql.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.