-
Notifications
You must be signed in to change notification settings - Fork 24
Fix ConnectionString forwarded improperly #584
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While your changes are reasonable, they unfortunately do not tackle the actual issue.
Please reread the issue your are referencing and check the provided code reference as to were the improper/not-usage of the connection string for the database test occurs (which is in the .net code of the command center). The issue is specifically that the connection string is not used at all for the connection test but a default user instead. Disabling the save button will not help here, instead it would actually limit the users options to still modify the config even though we don't detect that the database is available.
Moreover, @MathoMathiasCamara whats your opinion on just disabling the save button while the connection test is running? I would have thought a small loading icon where we later show the connected/disconnected icons would be more user friendly, maybe with a hover text explaining that the connection to the db is currently tested.
Lastly, please rebase your changes after you have modified them onto the release/6 branch and start with #583 instead of this one. Our usual modus operandi is: Target lowest release first, then merge/port upwards 😊
c7d63e0
to
8cd6eea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested it with the latest versions again, and it seems to be fine. So there is no need for this whole change. Save
should always be possible (after test) because on commissioning it is important to prepare the configs and later use the connection.
The only improvements I have, were already mentioned by @1nf0rmagician: Show some kind of busy indicator and disable save button during test.
I think this is a misunderstanding @dbeuchler, the issue that this change should solve is also visible on the gif you shared. While you have a correct database connection, assuming your user foo exists in the database server. The funny behaviour we observed was that, the test will show an error even if foo is a valid admin. This is because the connection used for the test has no database specified, for some reason it takes the user name as the database name for the test then. Obviously their won't be a foo database, hence the UI will show an error with the connection config. |
I have investigated a bit more: You must always specify a database name when connecting to PostgreSQL. There is no supported way to connect without one. This is a PostgreSQL server limitation, not just an Npgsql behavior. It is also hidden in the implementation of Npgsql, if the database-name is empty, the username is used: https://github.com/npgsql/npgsql/blob/main/src/Npgsql/NpgsqlConnection.cs#L445 I also have checked ms-sql and there it is also not possible to connect without a database: For server-level checks, explicitly set Database=master in the connection string. The master database always exists and is suitable for administrative queries. I don't like this "copy" of the So thanks for the breakdown, I have learned again something 🤣 |
a4410e2
Problem: Using a user other than `postgres` causes the connection test to fail. This occurs because the ConnectionString lacks a `Database` attribute during the test. As a result, the npgsql defaults to using the `User` attribute as the database name, which leads to a `DatabaseNotFound` error as no matching database exists. Solution: Using a custom config for testing the database server's connection status with database being "postgres". INFO: This migh lead to an edge-case where the user in unable to create/ delete databases if the "postgres" database has been deleted. Also added missing `outline` to the save button for the database config. closes #539
a4410e2
to
3444287
Compare
Problem:
Using a user other than
postgres
causes the connection test to fail.This occurs because the ConnectionString lacks a
Database
attributeduring the test.
As a result, the npgsql defaults to using the
User
attribute as thedatabase name, which leads to a
DatabaseNotFound
error as no matchingdatabase exists.
Solution:
Using a custom config for testing the database server's connection status
with database being "postgres".
INFO:
This migh lead to an edge-case where the user in unable to create/ delete
databases if the "postgres" database has been deleted.
Also added missing
outline
to the save button for the database config.closes #539