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

[postgreSQL] Do not connect to postgres DB when no new DB has to be created (use existing DB) #404

Open
GWarsow opened this issue Nov 17, 2024 · 1 comment

Comments

@GWarsow
Copy link

GWarsow commented Nov 17, 2024

Describe the bug
I want to access a cloud-based postgreSQL DB with this adapter. There, I do not have access to the postgres DB, only to my dedicated DB. So it should be sufficient to tick Datenbank nicht erstellen (bereits erstellt) because then no DB would have to be registered in the postgres DB.

To Reproduce
Steps to reproduce the behavior:

  1. Go to /#tab-instances/config/system.adapter.sql.0
  2. Choose PostegreSQL as DB type
  3. Enter valid credentials/parameters
  4. Make sure to select Datenbank nicht erstellen (bereits erstellt)
  5. Click on "Verbindung testen"
  6. See error: error: permission denied for database "postgres"

Expected behavior
A connectin to the DB should be established, even when the DB user does not have permission to access DB postgres if adapter.config.doNotCreateDatabase is true.
Currently, connection to postres is attempted altough this is not needed:

                if (adapter.config.doNotCreateDatabase) {
                    _client.disconnect();
                    postgresDbCreated = true;

Versions:

  • Adapter version: v3.0.1
  • JS-Controller version: 6.0.11
  • Node version: v20.17.0
  • Operating system: Debian GNU/Linux 12 (bookworm)
@GWarsow
Copy link
Author

GWarsow commented Nov 17, 2024

The check

ioBroker.sql/main.js

Lines 526 to 528 in 0ce044a

if (adapter.config.doNotCreateDatabase) {
_client.disconnect();
postgresDbCreated = true;

could be done prior to
if (adapter.config.dbtype === 'postgresql' && !postgresDbCreated) {

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

1 participant