Created
August 4, 2020 17:17
-
-
Save fabiojwalter/95823c171fb9b59d687c240351f17f2f to your computer and use it in GitHub Desktop.
SQL Query - List PostgreSQL tables per schema
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select table_schema, | |
table_name, | |
ordinal_position as position, | |
column_name, | |
data_type, | |
case when character_maximum_length is not null | |
then character_maximum_length | |
else numeric_precision end as max_length, | |
is_nullable, | |
column_default as default_value | |
from information_schema.columns | |
where table_schema in ('public') | |
order by table_schema, | |
table_name, | |
ordinal_position; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment