The psql program has a bug which prevents \c command from connecting to other databases.
Thanks to Ernst Molitor for discovering the problem and supplying the fix.
Apply this patch.
*** src/bin/psql/psql.c 1995/07/24 07:17:13 1.1
--- src/bin/psql/psql.c 1995/07/24 07:23:38
***************
*** 309,315 ****
printf("closing connection to database:%s\n", dbname);
olddb = db;
- PQfinish(olddb);
db = PQsetdb(PQhost(olddb), PQport(olddb), NULL, NULL, newdbname);
*db_ptr = db;
printf("connecting to new database: %s\n", newdbname);
--- 309,314 ----