2

Since I am new to postgresql shell command lines, I am very much confused on switch between servers, databases. First, I have logged in using default values in shellSql window. It is opening second server in my pgadmin server lists(in order). But my question here is how to switch between different servers through shell commands? Example: If I have 3 servers (postgresql9, postgresql11 and remote servers).

2
  • \connect postgresql.org/docs/current/… Commented Feb 23, 2020 at 10:07
  • and use \conninfo to check where you are currently connected to, see: \? for more options Commented Feb 23, 2020 at 10:15

1 Answer 1

2

This is directly given in documentation PSQL-META-COMMANDS

Examples:

=> \c mydb myuser host.dom 6432
=> \c service=foo
=> \c "host=localhost port=5432 dbname=mydb connect_timeout=10 sslmode=disable"
=> \c postgresql://tom@localhost/mydb?application_name=myapp
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.