qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.61k stars 3.01k forks source link

allow omitting the "SSL mode" when configuring a PostGis connection. #50842

Open lovasoa opened 2 years ago

lovasoa commented 2 years ago

Problem description

When setting up a new postgres connection in QGis, the user is currently forced to specify a value for the sslmode parameter, and the value disable is selected by default.

![image](https://user-images.githubusercontent.com/552629/200887960-4cd44e01-75d2-4616-a9ae-411d55016f22.png) ![image](https://user-images.githubusercontent.com/552629/200897482-a161ecb6-ec2a-4961-bb2b-f30f2bd1e2b5.png)

This is problematic, because

Suggested changes

Add a "use default" option the the dropdown, that will not hardcode any ssl mode, and connect to the database without specifying an sslmode in the connection string. This way, by default, postgres will use prefer as an SSL mode, but if someone has a service file with a different ssl mode specified, it will be respected. And the ssl mode will not be hardcoded in layer references when saving a project.

Additional context

No response

komima commented 2 years ago

Possibly related to this feature, something has changed in last few QGIS version since a connection can no longer be created with only the connection human readable name filled in. If the database connection parameters are provided from the runtime environment via libpq environment variables, its possible for the project file to only contain connection strings with the table name, geometry column etc. and all other options are used from the environment automatically.

OK button becomes active only if at least service name or database name is specified. Dialog should allow leaving fields empty.