4 ms·
You got some good answers already, but one thing to note is that a Postgres connection is always to a single database. So you can query across multiple schemas
by uhoh-itsmaciek 7y ago
You got some good answers already, but one thing to note is that a Postgres connection is always to a single database. So you can query across multiple schemas from the same connection, but not multiple databases.
- quietbritishjim 7y agoIndeed, this means that it is logically impossible to connect to postgres and create a database, at least through a normal connection. But you can create a schema with the CREATE SCHEMA statement.
- uhoh-itsmaciek 7y agoYou can create databases via sql [1]. It's just that after you run the statement, you're still connected to the old database and you need to disconnect in order to connect to the new one. [1]: https://www.postgresql.org/docs/current/sql-createdatabase.html https://www.postgresql.org/docs/current/sql-createdatabase.h...
- quietbritishjim 7y agoWow, I had no idea. Thank you so much! (A few lost internet points from the downvotes are well worth it for that gem of knowledge.)