Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database does not appear #126

Open
apiszcz opened this issue Mar 8, 2020 · 23 comments
Open

Database does not appear #126

apiszcz opened this issue Mar 8, 2020 · 23 comments
Assignees
Labels
Milestone

Comments

@apiszcz
Copy link

apiszcz commented Mar 8, 2020

Windows 10
PostGres 12.2
PostGIS 3.0
pgrouting 3.0.0-rc1
pgroutinglayer 3.0.0
QGIS 3.12

The database is loaded with OSM and works and display the layer properly in QGIS.
The pgroutinglayer plugin Database selection widget is blank.
The database has a username and password, however it is not on the standard postges port 5432.

Is there a configuration requirement for the connection? The connection appears correctly in the QGIS Browser.

Quickly reviewed the connectors/postgis.py, and am wondering the issue is related to this code not acquiring active database connections.

Thank you.

@apiszcz apiszcz added the bug label Mar 8, 2020
@cayetanobv
Copy link
Member

Hi @apiszcz ,

This plugin uses all PostgreSQL connections you have added to QGIS so the port is not a problem. The issue could be you don't have a pgRouting database with pgRouting extension created. You could check what you need in pgRouting docs: http://docs.pgrouting.org/latest/en/pgRouting-concepts.html#create-a-routing-database

Thanks,

@apiszcz
Copy link
Author

apiszcz commented Mar 8, 2020 via email

@apiszcz
Copy link
Author

apiszcz commented Mar 9, 2020

osm1=# select * from pgr_version();
 pgr_version
-------------
 3.0.0-rc1
(1 row)

@cayetanobv
Copy link
Member

This plugin was developed with last stable (v2.6) but taking into account compatibility with dev version. We need to recheck that again. Did you try with v2.6?

@apiszcz
Copy link
Author

apiszcz commented Mar 9, 2020 via email

@apiszcz
Copy link
Author

apiszcz commented Mar 9, 2020

postgis.py seems to capturing the parameters

2020-03-09T14:09:36     WARNING    SERVICE: , HOST: localhost, PORT: 5444, DBNAME: osm1, USER: postgres
        self.service = uri.service()
        self.host = uri.host()
        self.port = uri.port()
        self.dbname = uri.database()
        self.user = uri.username()
        self.passwd = uri.password()
        QgsMessageLog.logMessage("SERVICE: %s, HOST: %s, PORT: %s, DBNAME: %s, USER: %s"%(self.service,self.host,self.port,self.dbname,self.user), "PGR_DEBUG")

Connection string looks good

2020-03-09T14:17:32 WARNING con_str host='localhost' port=5444 dbname='osm1' user='postgres' password='pg'

@apiszcz
Copy link
Author

apiszcz commented Mar 10, 2020

Problem #1 with FIX

pgRoutingLayer_utils::getPgrVersion(con):
WAS
select version from pgr_version();

NOW
select pgr_version from pgr_version();

osm=# select version from pgr_version();
ERROR:  column "version" does not exist
LINE 1: select version from pgr_version();
               ^

osm=# select pgr_version from pgr_version();
 pgr_version
-------------
 3.0.0-rc1

@apiszcz
Copy link
Author

apiszcz commented Mar 10, 2020

The change described above allows me to connect to the database.

@cvvergara
Copy link
Member

SELECT version FROM pgr_full_version();

This needs to be fixed

@tjukanovt
Copy link

I am facing the same issue with almost identical setup. Did you @apiszcz just edit the .py file directly in your plugin profiles folder and then reloaded it? I did that but still can't get the db connection to show.

@apiszcz
Copy link
Author

apiszcz commented Apr 2, 2020

Yes.
Be sure you connect to the database with the QGIS Browser, PostGres.

@tjukanovt
Copy link

Yes I have connection established already and accessible through the QGIS Browser.

Also changed this line:
cur.execute('SELECT pgr_version FROM pgr_version()')
But still not working.

@cOsprey
Copy link

cOsprey commented Apr 2, 2020

I tried to follow and changed but still I'm having the issue.

@apiszcz
Copy link
Author

apiszcz commented Apr 2, 2020

  1. Review QGIS->View->Message Logs
  2. Review postgres log file for connection errors.
    The 'SELECT pgr_version FROM pgr_version()' command works ok from PSQL?

@tjukanovt
Copy link

Checked the pgRoutinLayer logs and it seems that the password authentication fails:

2020-04-02T15:22:35 INFO dbname:gisdata, FATAL: password authentication failed for user "postgres"
password retrieved from file "C:\Users\tjukanovt\AppData\Roaming/postgresql/pgpass.conf"

But when I check the pgpass file, it seems that the password (which is stored as plain text 🤨) is correct. And also like I said, normal authentication to the same database works in QGIS.

The query
SELECT pgr_version FROM pgr_version()
does work and returns pgr_version
3.0.0-rc1

@tjukanovt
Copy link

Now I got this working. If someone else faces the same issue: in the pgpass.conf file for some reason the text is in small letters although my credentials included capitals. For normal QGIS DB connection this is not a problem, but I changed the pgpass password manually and now the connection was succesful!

@dkastl
Copy link
Member

dkastl commented Apr 6, 2020

Thanks for reporting your solution @tjukanovt !
Can others in this thread confirm that it was caused by the password?

@cayetanobv
Copy link
Member

Hi all,

Fixed pgr_version issue to support v3 with #128

Regard password issue, I don't know why are occurring that. I know this side of the code is old so it needs a little bit of refactoring to better handling of new QGIS API :)

@cayetanobv cayetanobv self-assigned this Apr 14, 2020
@cayetanobv cayetanobv added this to the Release 3.0.0 milestone Apr 14, 2020
@Langlaeufer
Copy link

Langlaeufer commented Jun 26, 2020

I have the same Issue
Postgres 12.3
PostGIS 3.0.1
QGIS 3.12.3 / 3.14.0
PgRoutingLayer 3.0.0

From pgRoutingLayer Protokoll
2020-06-26T11:15:26 INFO startup version 2.6
2020-06-26T11:15:45 INFO dbname:routing, fe_sendauth: no password supplied

layer is available in QGIS
username and password in pgpass.conf are correct

@darrencope
Copy link

I'm still seeing the original issue. Is it expected to be fixed in the current release?

The pgRoutingLayer log in QGIS says:
CRITICAL dbname:ncr_routing, connection to server at "localhost" (::1), port 5432 failed: fe_sendauth: no password supplied

I am able to run pgRouting queries in both pgAdmin and DB Manager plugin in QGIS with no problem, so the connection is fine, and everything appears to be up and running from the perspective of both QGIS and pgAdmin. It's just the pgRoutingLayer plug that seems to have the connection issue. I don't see pgpass.conf anywhere on my system, so perhaps this has changed in newer versions?

@sanak
Copy link
Member

sanak commented Oct 20, 2022

Hi @darrencope,
Thanks for reporting the issue!

If possible, could you share your current environment ?

  • OS:
  • PostgreSQL version:
  • PostGIS version:
  • pgRouting version:
  • QGIS version:
  • pgRoutingLayer version: (I think that you are using the latest (3.0.2).)

Thanks,

@darrencope
Copy link

@sanak Of course!

  • OS: Windows 11 Home
  • PostgreSQL: PostgreSQL 14.5, compiled by Visual C++ build 1914, 64-bit
  • PostGIS: POSTGIS="3.3.1 3.3.1" [EXTENSION] PGSQL="140" GEOS="3.11.0-CAPI-1.17.0" PROJ="7.2.1" LIBXML="2.9.9" LIBJSON="0.12" LIBPROTOBUF="1.2.1" WAGYU="0.5.0 (Internal)"
  • pgRouting: 3.3.4
  • QGIS: 3.22.11-Białowieża
  • pgRoutingLayer: 3.0.2

@sanak
Copy link
Member

sanak commented Oct 21, 2022

@darrencope Thanks for the information!
I will take a look in this weekend with similar environment as much as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants