I've been working on your patch. Attached is a version I'd be happy to
commit. Please check that it's okay with you.
I rewrote the option argument parsing logic a little bit to be more
clear and provide more specific error messages.
I reinstated the requirement that both old and new directory are
absolute. After consideration, I think this makes sense because all
tablespace directories are always required to be absolute in other
contexts. (Note: Checking for absolute path by testing the first
character for '/' is not portable.)
I also removed the partial matching. This would have let -T /data1=...
also match /data11, which is clearly confusing. This logic would need
some intelligence about slashes, similar to fnmatch(). This could
perhaps be added later.
Finally, I wrote some test cases for this new functionality. See the
attached patch, which can be applied on top of
<https://commitfest.postgresql.org/action/patch_view?id=1394>.