aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/command.c')
-rw-r--r--src/bin/psql/command.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 5b4d54a4425..80b81e811d8 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -3041,8 +3041,14 @@ do_connect(enum trivalue reuse_previous_specification,
psql_error("\\connect: %s", PQerrorMessage(n_conn));
if (o_conn)
{
+ /*
+ * Transition to having no connection. Keep this bit in sync
+ * with CheckConnection().
+ */
PQfinish(o_conn);
pset.db = NULL;
+ ResetCancelConn();
+ UnsyncVariables();
}
}
@@ -3056,7 +3062,8 @@ do_connect(enum trivalue reuse_previous_specification,
/*
* Replace the old connection with the new one, and update
- * connection-dependent variables.
+ * connection-dependent variables. Keep the resynchronization logic in
+ * sync with CheckConnection().
*/
PQsetNoticeProcessor(n_conn, NoticeProcessor, NULL);
pset.db = n_conn;
@@ -3131,7 +3138,8 @@ connection_warnings(bool in_startup)
sverbuf, sizeof(sverbuf)));
#ifdef WIN32
- checkWin32Codepage();
+ if (in_startup)
+ checkWin32Codepage();
#endif
printSSLInfo();
}