Skip to content

Instantly share code, notes, and snippets.

@jdecode
Created March 21, 2020 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdecode/601b871a5973fe2f95069025aab887d3 to your computer and use it in GitHub Desktop.
Save jdecode/601b871a5973fe2f95069025aab887d3 to your computer and use it in GitHub Desktop.
PostgreSQL commands

Please note the following commands:

\list or \l: list all databases

\dt: list all tables in the current database using your search_path

\dt *.: list all tables in the current database regardless your search_path

You will never see tables in other databases, these tables aren't visible. You have to connect to the correct database to see its tables (and other objects).

To switch databases:

\connect database_name or \c database_name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment