HI think that your patch is responsible for the added option at least.

I agree that the underlying issue that other parameters should probably
also be reused, which would be a bug fix, does not belong to this thread.

This doesn't seem to be a bug.  \connect just establishes a new connection, not 
reusing the previous settings for most connection parameters.  As the examples 
in the following manual page show, the user needs to specify necessary 
connection parameters.

https://www.postgresql.org/docs/devel/app-psql.html

=> \c service=foo
=> \c "host=localhost port=5432 dbname=mydb connect_timeout=10 sslmode=disable"


But I'm afraid the description of \connect may not be clear enough about connection parameters, and that may cause users to expect the reuse of all connection parameter settings.

I think that the typical use-case of \c is to connect to another database on the same host, at least that what I do pretty often. The natural expectation is that the same "other" connection parameters are used, otherwise it does not make much sense, and there is already a whole logic of reusing the previous settings in psql, at least wrt describing the target (host, port, user…).

Anyway, I think this would be an improvement for psql's documentation or new feature for psql. What do you think?

I think that we should fix the behavior rather than document the current weirdness. I do not think that we should introduce more weirdness.

--
Fabien.

Reply via email to