Skip to content

Instantly share code, notes, and snippets.

@aykuli
Last active September 24, 2023 17:20
Show Gist options
  • Select an option

  • Save aykuli/5336ed4142bbbcf9bdde75396238b89f to your computer and use it in GitHub Desktop.

Select an option

Save aykuli/5336ed4142bbbcf9bdde75396238b89f to your computer and use it in GitHub Desktop.
psql commands

psql commands

my list

command meaning comment
\c database_name --
\dt list of relations --
\d list of relations in current database --
\d table_name describe table, view, sequence, or index --
\dn list of schemas in current database --
\x -- Expanded display is on.
\x* postgis* List of installed extensions with regexp postgis*
\f List of available functions --

Enter to psql inside docker container through console

sudo docker exec -it <container-name> psql -U <username> -d <database_name>

Run script from file inside docker container

cat ./<file-name>.sql | sudo docker exec -i <container_name> psql -U <username>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment