我是PostgreSQL的初学者。
I am beginner to PostgreSQL.
我想从Postgres的查询编辑器连接到另一个数据库,例如 USE 命令。
I want to connect to another database from the query editor of Postgres - like the USE command of MySQL or MS SQL Server.
我通过搜索Internet找到了 \c数据库名称,但是它只能在 psql 。当我从PostgreSQL查询编辑器尝试它时,出现语法错误。
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.
我必须通过pgscripting更改数据库。有人知道怎么做吗?
I have to change the database by pgscripting. Does anyone know how to do it?
推荐答案当您与 PostgreSQL 总是到特定的数据库。要访问其他数据库,必须获得新的连接。
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.
在psql中使用 \c 关闭旧的数据库连接并使用指定的数据库和/或凭据获取新的连接。您将获得一个全新的后端流程以及所有内容。
Using \c in 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.
更多推荐
“使用数据库名称” PostgreSQL中的命令
发布评论