I am beginner to PostgreSQL.
I want to connect to another database from the query editor of Postgres – like the USE command of MySQL or MS SQL Server.
I found \c databasename by searching the Internet, but its runs only on psql. When I try it from the PostgreSQL query editor I get a syntax error.
I have to change the database by pgscripting. Does anyone know how to do it?
When you get a connection to PostgreSQL it is always to a particular database. To access a different database, you must get a new connection.
Using
\cin psql closes the old connection and acquires a new one, using the specified database and/or credentials. You get a whole new back-end process and everything.Example: