Sometimes it is necessary to use the psql command line tool to quickly explore odds in database. Often you also need to use some commands to view structure of your database or tables. In PostgreSQL (and also in other database systems) you can do that by querying system tables like pg_tables , pg_class , pg_attribute and so on.
Following you’ll find some quick commands for doing that a little bit easier.
|This command is in general the shortcut for “describe”. In other database systems the “desc” keyword is used instead.
|Displays all your user defined tables.
|Displays all your user defined data types.
|Displays all your user defined functions.
|Displays all your user defined indexes.
|Displays all your user defined views.
|Displays all namespaces.
|Displays all users.
|Displays all databases.
|Describes the table [tablename] with all fields and indexes.
Also most of this commands can be used in combination with a search pattern. So dt proj_* will list all tables with the prefix proj_ respectively.