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 44a782478d1..4b2679360fc 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -402,13 +402,27 @@ CheckConnection(void)
if (!OK)
{
fprintf(stderr, _("Failed.\n"));
+
+ /*
+ * Transition to having no connection. Keep this bit in sync with
+ * do_connect().
+ */
PQfinish(pset.db);
pset.db = NULL;
ResetCancelConn();
UnsyncVariables();
}
else
+ {
fprintf(stderr, _("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;