This allows control of the directory in which the postmaster sockets are created for the temporary postmasters started by pg_upgrade. The default location remains the current working directory, which is typically fine, but if it is deeply nested then its pathname might be too long to be a socket name.
In passing, clean up some messiness in pg_upgrade's option handling, particularly the confusing and undocumented way that configuration-only datadirs were handled. And fix check_required_directory's substantially under-baked cleanup of directory pathnames.
Daniel Gustafsson, reviewed by Hironobu Suzuki, some code cleanup by me
2d34ad8430 Add a --socketdir option to pg_upgrade.
doc/src/sgml/ref/pgupgrade.sgml | 36 ++++++++++++++++---
src/bin/pg_upgrade/option.c | 80 ++++++++++++++++++++++-------------------
src/bin/pg_upgrade/pg_upgrade.h | 5 +--
3 files changed, 77 insertions(+), 44 deletions(-)