This article is half-done without your Comment! *** Please share your thoughts via Comment ***
If you are also working in SQL Server, switching the database is very common in the code. But in the PostgreSQL, this is not a common practice.
PostgreSQL: Should we create Multiple Databases OR create Multiple Schemas?
In the PostgreSQL, you cannot perform cross-database queries easily. For that, you need to setup DBLINK.
PostgreSQL [Video]: Cross Database Queries using DbLink Extension
Still switching of the database is possible in PostgreSQL, but you cannot use two databases in a single code block/sql function.
Here, the switching of the database means to switch the complete connection from existing database to some other database.
Please don’t try this switching option using PgAdmin Tool. You can do this using PSQL.
Use below command for switching database/connection in PSQL:
1 |
\c database_name |
Check my test result in below screenshot:
PostgreSQL: The Schema Search Path and change the default PUBLIC Schema
Leave a Reply