Bug report #14436
Failure to connect to postgres database defined as service in DB manager
Status: | Closed | ||
---|---|---|---|
Priority: | Severe/Regression | ||
Assignee: | Alessandro Pasotti | ||
Category: | DB Manager | ||
Affected QGIS version: | 2.14.0 | Regression?: | No |
Operating System: | Ubuntu | Easy fix?: | No |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 22415 |
Description
I have set-up a new database connection in QGIS that uses service connection. I can connect successfully but when I try to connect to the same database it fails to connect. The error seems to be centred on DB manager not reading the service files correctly. It reads the user-name as database name and this causes it not to connect
Related issues
Associated revisions
[dbmanager] PG ignore env if service file is used
Cherry-picked from master
Fixes #14436
Funded by Boundless
History
#1 Updated by Luigi Pirelli over 8 years ago
please check if connection is set-up correctly with the target DB name
#2 Updated by Admire Nyakudya over 8 years ago
When I click on Add postgis layers and define my service configuration I can access the database tables. It is only when I try to access the database using DB manager that it fails to connect
#3 Updated by Luigi Pirelli over 8 years ago
again... try to setup dbname in the connection con figuration. dbname is not set in the screenshot you sent.
#4 Updated by Admire Nyakudya over 8 years ago
If I define a dbname it works. But I thought the point of using service files is to have the whole database configuration defined in the service file and then just connect. So this way does it mean the port,user name,password are the only parameters that are read from the service file when using DB Manager. When using service files with the Add postgis layers you can just specify service file and no other parameters and it still works.
#5 Updated by Luigi Pirelli over 8 years ago
I don't think this is a but... but a feature request
when you add a db layer you connect to a specified db+table (otherwise default is tablename=username)... also just testing connection need a db... if not set it test on postgres db that is the administrative db always present.
if need db metadata... eg list of tables in a db, you have to connect to postgresdb and query relative tables.
if you need installed db on a remote db.
I feel that this have to be changed to feature request or removed as bug.
#6 Updated by Tim Sutton over 8 years ago
Hi Luigi. For me it is a regression - the behaviour changed from how it worked before in < 2.14 and if you are using a service file then you should not need to set the db name or other connection information since these are specified in the service file.
#7 Updated by Luigi Pirelli over 8 years ago
Sorry
I didn't know was a regression due to my lack of user experience
@Admire, just a question. your DB connection is set-up using basic authentication with user and pwd? or do you use any of the "new" authentication features storing credentials in auth-db? (settings->options->authentication).
The answer is useful to me to replicate the problem
#8 Updated by Admire Nyakudya over 8 years ago
- File pg_service.conf added
I currently use basic authentication. I have uploaded a sample service file. [[http://www.postgresql.org/docs/9.1/static/libpq-pgservice.html]]
#9 Updated by Luigi Pirelli over 8 years ago
sorry for my late... we are really busy on testing plugins stuffs. I'll be back on this issue in some days
#10 Updated by Giovanni Manghi over 8 years ago
- Priority changed from High to Severe/Regression
- Target version changed from Version 2.14 to Version 2.16
#11 Updated by Alessandro Pasotti over 8 years ago
- Assignee changed from Luigi Pirelli to Alessandro Pasotti
- Status changed from Open to In Progress
#12 Updated by Anonymous over 8 years ago
- Status changed from In Progress to Closed
Fixed in changeset 212b125a2c2eba93f2c8e3b991ea4be4fdc57623.
#13 Updated by Luigi Pirelli over 8 years ago
tnx elpaso
#14 Updated by Paolo Cavallini over 8 years ago
Could you please backport it? Thanks.
#15 Updated by Alessandro Pasotti over 8 years ago
I've done it already with 0bde357
#16 Updated by Paolo Cavallini over 8 years ago
Great, thanks.
#17 Updated by Sandro Santilli over 7 years ago
- Related to Bug report #16626: DBManager fails to load rasters from service-only PostGIS connections added
#18 Updated by Sandro Santilli over 7 years ago
- Related to Bug report #16625: DBManager fails to load raster from dbname-less connection added