libpgtcl has a hard-wired default value of "4321" for the port number. Instead, it should use the compile-time variable POSTPORT.
Apply this patch.
diff -c -r1.4 src/libpgtcl/pgtclCmds.c
*** 1.4 1995/03/11 01:00:50
--- src/libpgtcl/pgtclCmds.c 1995/05/22 22:02:45
***************
*** 27,35 ****
static char* DefaultHost = "localhost";
static char* DefaultTTY = "/dev/null";
! static int DefaultPort = 4321;
-
/**********************************
* pg_connect
make a connection to a backend.
--- 27,38 ----
static char* DefaultHost = "localhost";
static char* DefaultTTY = "/dev/null";
! #ifdef POSTPORT
! static char* DefaultPort = POSTPORT;
! #else
! static char* DefaultPort = "5432";
! #endif /* POSTPORT */
/**********************************
* pg_connect
make a connection to a backend.
***************
*** 65,71 ****
pqtty = (temp = getenv(ENV_DEFAULT_TTY)) ? temp : DefaultTTY;
/* use default settings for pg env */
if (!(temp = getenv(ENV_DEFAULT_PORT)))
! pqport = DefaultPort;
else
pqport = atoi(temp);
--- 68,74 ----
pqtty = (temp = getenv(ENV_DEFAULT_TTY)) ? temp : DefaultTTY;
/* use default settings for pg env */
if (!(temp = getenv(ENV_DEFAULT_PORT)))
! pqport = atoi(DefaultPort);
else
pqport = atoi(temp);