martes, 20 de octubre de 2009

Get list tables from postgres database

If we need to iterate over all tables of a certain schema, we can get the list of schema, table, type and user using psql:


$ psql -qAtF, -c "\dt da_schema.*"
da_schema,segments,table,jacen
da_schema,speeds,table,jacen
$ _


You can also use "*" in the schema name, for example:

$ psql -qAtF, -c "\dt da_schema*.*"
da_schema,segments,table,jacen
da_schema,speeds,table,jacen
da_schema_2,labels,table,jacen
da_schema_test,positions,table,jacen
$ _