diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2020-10-22 14:04:21 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2020-10-22 14:04:28 -0400 |
commit | 94929f1cf6cb3ea070d0919d1303379b525a72a3 (patch) | |
tree | 48103118198b9d51de3bd8efa0b1768bcc3d1c03 /src/interfaces/ecpg/test/expected/preproc-strings.c | |
parent | 866e24d47db1743dfcff5bd595b57e3a143f2cb1 (diff) | |
download | postgresql-94929f1cf6cb3ea070d0919d1303379b525a72a3.tar.gz postgresql-94929f1cf6cb3ea070d0919d1303379b525a72a3.zip |
Clean up some unpleasant behaviors in psql's \connect command.
The check for whether to complain about not having an old connection
to get parameters from was seriously out of date: it had not been
rethought when we invented connstrings, nor when we invented the
-reuse-previous option. Replace it with a check that throws an
error if reuse-previous is active and we lack an old connection to
reuse. While that doesn't move the goalposts very far in terms of
easing reconnection after a server crash, at least it's consistent.
If the user specifies a connstring plus additional parameters
(which is invalid per the documentation), the extra parameters were
silently ignored. That seems like it could be really confusing,
so let's throw a syntax error instead.
Teach the connstring code path to re-use the old connection's password
in the same cases as the old-style-syntax code path would, ie if we
are reusing parameters and the values of username, host/hostaddr, and
port are not being changed. Document this behavior, too, since it was
unmentioned before. Also simplify the implementation a bit, giving
rise to two new and useful properties: if there's a "password=xxx" in
the connstring, we'll use it not ignore it, and by default (i.e.,
except with --no-password) we will prompt for a password if the
re-used password or connstring password doesn't work. The previous
code just failed if the re-used password didn't work.
Given the paucity of field complaints about these issues, I don't
think that they rise to the level of back-patchable bug fixes,
and in any case they might represent undesirable behavior changes
in minor releases. So no back-patch.
Discussion: https://postgr.es/m/235210.1603321144@sss.pgh.pa.us
Diffstat (limited to 'src/interfaces/ecpg/test/expected/preproc-strings.c')
0 files changed, 0 insertions, 0 deletions