23

I'm using DBeaver with Postgres. I can open a new sql editor with ctl+[.

But I have multiple databases in my Postgres. How can I have the sql editor run against another database? the following doesn't work

use <db name>;
select * from <table name>;

dbeaver ui

Harry Moreno
  • 10,231
  • 7
  • 64
  • 116

3 Answers3

22

You can set a different database as active in your current connection by right-clicking in the Database Navigator pane and selecting "Set active", below I am switching from 'postgres' to my 'report_service' DB (this is version 6.1.2, not sure about other versions)

enter image description here

EDIT: I have recently upgraded to version 6.3.5 and this now has "Set as default" in the dropdown rather than "Set active" but this seems to be roughly the same behaviour

DatabaseShouter
  • 814
  • 9
  • 11
17

You can change the currently selected database when you create new sql tabs by selecting it from the dropdown.

dbeaver change database

When you do so be sure to double-click on the schema you want to bring into focus. Then you can open new sql editors with ctrl+].

Harry Moreno
  • 10,231
  • 7
  • 64
  • 116
  • 1
    In v6.3.0 this drop-down doesn't work fine and change selected DB is almost impossible. – EAmez Dec 20 '19 at 10:08
1

I've found the solution. Press Ctrl+9 and choose your destiny-base...

Press Ctrl+9 and chooz

Harry Moreno
  • 10,231
  • 7
  • 64
  • 116
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 08 '23 at 17:33
  • The answer from @harry_moreno is perfect and bulls eye to the raised question. I have looked for month regularly having a go in Google but came up with nothing ... until now! Ctrl-9. Thanks Harry Moreno! – wideseen Aug 08 '23 at 07:00