Skip to content

Instantly share code, notes, and snippets.

@house9
Created December 2, 2011 14:51
Show Gist options
  • Save house9/1423507 to your computer and use it in GitHub Desktop.
Save house9/1423507 to your computer and use it in GitHub Desktop.
select_table_and_columns_from_postgres.sql
select
tables.table_name,
columns.column_name
from information_schema.tables
inner join information_schema.columns
on information_schema.columns.table_name = information_schema.tables.table_name
where tables.table_schema = 'public'
and tables.table_type = 'BASE TABLE'
order by tables.table_name, columns.column_name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment