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 role in QGIS configuration reverted to username of operating system #82

Open
christianbraun opened this issue Jan 23, 2025 · 5 comments

Comments

@christianbraun
Copy link

Dear all,
I am trying to establish a connection to a 3DCityDB in QGIS via the plugin. Credentials are stored as configuration.
However, I get the following error:
Invalid connection settings ERROR at citydb-tools/cdb4/gui_db_connector/functions/conn_functions.py>open_db_connection
ERROR: FATAL: role "cbraun_21926" does not exist

It puts as role my username of the operation system (cbraun_21926) instead of the one from the configuration. Connection fails because the role is not present in the db.

Many thanks in advance,
Christian

@christianbraun christianbraun changed the title Database role reverted to username of operating system Database role in QGIS configuration reverted to username of operating system Jan 23, 2025
@gioagu
Copy link
Member

gioagu commented Jan 24, 2025

Dear Christian,

From what you describe, it sounds like the database user ("cbraun_21926") does not exist in the database itself.
Database users must be created beforehand to use the 3DCityDB-Tools plugin.
E.g. in PostgreSQL (e.g. via PGAdmin) you must create a user with the CREATE ROLE .... command.
More details here

Did you do it? Or did the database administrator did it for you?
Directly creating new users from the plugin itself is not possible.

If this does not solve your problem, or I have misunderstood your issue, let us know!

GA

@christianbraun
Copy link
Author

Sorry, I wasn't explicit enough: The DB role that I have specified in the DB connection gets overwritten with cbraun_21926. cbraun_21926 is not existing in the DB and never was before.
It was working before the last updates as usual

@gioagu
Copy link
Member

gioagu commented Jan 27, 2025

Hi @christianbraun,

I have tried to replicate your error on my system, but unfortunately I could not. So we need a bit more details. From my side:

  • Windows 11, QGIS 3.40, plugin version 0.8.10, PostgreSQL 16, 3DCityDB 4.41.

When I define a new connection from the plugin GUI, I enter the parameters in the GUI window and then I store them. All seems fine.

Image

I also created a new connection using QGIS' Data source manager. Again, I could create a new connection an use it from the plugin.

Image

Looking forward to more details from you.

Best regards,

GA

@christianbraun
Copy link
Author

Hi, I am happy to give you more details.
macOS 15.2, QGIS 3.40.3 (same for LTR 3.34.15), plugin version 0.8.10, PostgreSQL 15, 3DCityDB 4.40.

The connection from the plugin GUI is working if I define a new one like you did.
Image

A saved connection that was defined in QGIS Data source manager fails with the error I was mentioning before, trying to connect with my local user name.

 CRITICAL    Invalid connection settings ERROR at citydb-tools/cdb4/gui_db_connector/functions/conn_functions.py>open_db_connection
ERROR: FATAL: role "cbraun_21926" does not exist

@gioagu
Copy link
Member

gioagu commented Jan 27, 2025

Hi!

OK, at least we are narrowing it down little by little :-)

Now, we haven't changed anything in the plugin in the way we deal with connections since quite some time. So, my next questions are:

  • From which version of the plugin did you update? From 0.8.9 or from (much?) earlier?
  • Does this problem happen only with a previously stored connection? As you write, it seems that it is working when you define a new one. If so, it may be the easiest way to simply drop it and resave it.
  • It could also be that the values are (for whatever reason) stored wrong within QGIS. Maybe just have a look at the way they are stored. You can check it if you open the Advanced Settings. See screenshot (from QGIS 3.40).

Image

Last but not least, I have no MacOs machine, I will ask some colleagues to check.

Best regards,

GA

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

No branches or pull requests

2 participants