Postgres database dump and restore on different database
It sounds like you're trying to refresh a database that's a snapshot of another DB elsewhere, and do so without interrupting read access to the first DB.

If so, the easiest way is actually to do it live in the snapshot DB. Just begin a transaction, truncate all the tables, and populate them with new data, then commit. Concurrent transactions will see the old data until you commit, then see the new data.

If for some reason you can't do that, you may instead wish to populate one DB offline, then ALTER DATABASE ... RENAME to swap them. Doing this will require a brief period where all connections are forced offline and currently running transactions are aborted, which is why I suggest doing it with the first method above.

If all your tables are in one schema in the main DB you could instead populate a copy of the schema then ALTER SCHEMA ... RENAME to swap them. This doesn't require disconnection.