How to list all tables and views in Redshift

Run the below query to return all tables and views of a schema in Redshift database where schemaname is the name of the schema.

select table_name,'TABLE' from information_schema.tables where table_schema= 'schemaname' and table_type='BASE TABLE'
union
select table_name,'VIEW' from information_schema.views where table_schema= 'schemaname';
See also  How to list Materialized views, enable auto refresh, check if stale in Redshift database