aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/common.c')
-rw-r--r--src/bin/psql/common.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c
index 26bf613c1d6..9b5b8439608 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -423,13 +423,27 @@ CheckConnection(void)
if (!OK)
{
psql_error("Failed.\n");
+
+ /*
+ * Transition to having no connection. Keep this bit in sync with
+ * do_connect().
+ */
PQfinish(pset.db);
pset.db = NULL;
ResetCancelConn();
UnsyncVariables();
}
else
+ {
psql_error("Succeeded.\n");
+
+ /*
+ * Re-sync, just in case anything changed. Keep this in sync with
+ * do_connect().
+ */
+ SyncVariables();
+ connection_warnings(false); /* Must be after SyncVariables */
+ }
}
return OK;