I have installed PostgreSQL 13.1 on two computers, a laptop and desktop.
I created database using a Tablespace on a portable SSD drive under F:\MyProject\DB\PG_13_202007201\20350
. So I expect all the database files to be in there somewhere.
I want to work on the database on the SSD drive which is fine on the laptop that created the database, but when I go to my desktop I can't figure out how to attach (SQL Server style) the existing database/tablespace and continue working on it.
Is there a way to work like this with Postgresql?
Best Answer
I suggest you to create a new cluster in your external drive. You can use initdb to create a new PostgreSQL database cluster.
Here is a sample command;
After that you even can register your new cluster as a new postgresql server service by using pg_ctl like the one below;