This patch adds the ability to relocate tablespaces by adding the
command line argument --tablespace (-T) which takes a required argument
in the format "oid:tablespacedir". After all tablespaces are fetched
this code updates the symlink to point to the new tablespace location.
I would have loved to be able to pass tablespacename:tablespacedir
though, but sadly I wasn't able to figure out how to retrieve that
information without creating another connection to the database.
You could also use the format "olddir:newdir", because you do know that. It's not the name of the tablespace. but I think it's still more usefriendly than using the oid.
That's a much better solution, I attached a patch with the updated code.
# SELECT oid, pg_tablespace_location(oid) FROM pg_tablespace;