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
  • Operating system (distribution) and version : Windows 10
  • DBeaver version : 6.3.3
  • Additional extensions : none
  • Connection specification:

  • Database name and version : PostgreSQL
  • Driver name : PostgreSQL JDBC Driver
  • Do you use tunnels or proxies (SSH, SOCKS, etc)? No
  • Describe the problem you're observing:

    Since upgrading to DBeaver 6.3.2 and 6.3.3, scripts are not executed on the selected database, but on another database. I have several databases on the same PostgreSQL server, and I want to execute a script on each of the databases :

  • Right click on the initial database (database_dev), and select Tools/execute script : window open, OK
  • Select the script and run it : script run, OK
  • Right click on another database (database_prod), and select Tools/execute script : window open, OK
  • Select the script and run it : script run on the other database, and the log is incoherent :
  • C:\Users\nvervell\AppData\Roaming\DBeaverData\drivers\clients\postgresql\win\psql.exe --host=my-host-postgresql.postgres.database.azure.com --port=5432 --username=user@my-host-postgresql --echo-errors database_dev
    Task 'PostgreSQL script' started at Tue Jan 21 12:32:02 CET 2020
    Task 'PostgreSQL script' finished at Tue Jan 21 12:32:08 CET 2020
    2020-01-21 12:32:09.047 - Initiate connection to PostgreSQL database [user@my-host-postgresql.postgres.database.azure.com] for Main <database_prod>
    2020-01-21 12:32:09.614 - Initiate connection to PostgreSQL database [user@my-host-postgresql.postgres.database.azure.com] for Metadata <database_prod>
    

    As you can see, at the beginning of the log the command ends with "database_dev" (while I selected "database_prod" as the target), but at the end of the log it says "database_prod".

    It was working properly before the upgrade (I was using DBeaver 6.2.x), and I changed nothing in the configuration. I tried to create a separate connection for each database, rather than using the same connection, but nothing changed.

    Steps to reproduce, if exist:

    Include any warning/errors/backtraces from the logs

    I had a similar problem. Likely related to #7693 - the DB you think is active is not the one that is actually active.

    With previous versions, it wasn't depending on the active DB : using the contextual menu (Tools / Execute script) on a DB would run the script on this DB, whether or not it's the active DB.

    PostgreSQL : script executed on the wrong database PostgreSQL : Tools/Execute script => executed on the wrong database Jan 21, 2020 PostgreSQL : Tools/Execute script => executed on the wrong database PostgreSQL : "Tools/Execute script" on a database => executed on the wrong database Jan 21, 2020

    reopened
    npe appears in case of executing script on the wrong database (script contains select query, items from query doesn't exist in this db)

    > ****** --host=127.0.0.1 --port=35950 ****** --echo-errors eclipsecon-demo
    > Task 'PostgreSQL script' started at Thu Jan 23 12:58:08 MSK 2020
    > Task 'PostgreSQL script' finished at Thu Jan 23 12:58:11 MSK 2020
    > 2020-01-23 12:58:11.104 - No execution context within database instance
    > 2020-01-23 12:58:11.105 - java.lang.NullPointerException
    > 	at org.jkiss.dbeaver.ext.postgresql.model.PostgreDatabase.readDatabaseInfo(PostgreDatabase.java:151)
    > 	at org.jkiss.dbeaver.ext.postgresql.model.PostgreDatabase.refreshObject(PostgreDatabase.java:622)
    > 	at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.refreshNode(DBNDatabaseNode.java:324)
    > 	at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.doExecute(AbstractNativeToolHandler.java:248)
    > 	at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.lambda$0(AbstractNativeToolHandler.java:52)
    > 	at org.jkiss.dbeaver.runtime.RunnableContextDelegate.lambda$0(RunnableContextDelegate.java:39)
    > 	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
              

    NPE fixed.
    But I can't reproduce the root problem (error No execution context within database instance).
    Any steps to reproduce woudl be helpful