Reputation: 177
Does anybody know how to switch between PostgreSQL databases or schemas in DataGrip (The Database IDE from JetBrains) in the console?
i can do that in Mysql by using:
Use my_database;
I tried using the Psql methods like
\connect
or
\c
but nothing works.
And could not find anyting in DataGrip Help page.
Upvotes: 10
Views: 10845
Reputation: 22907
To change the use of a database, you can do it by:
You can delete the disused consoles as follows:
Select a database to perform sql queries:
public schema
> In this way in the directory Files> Scratches and Consoles > Database Consoles > PostgreSQL - @localhost, a new console positioned in said database was added.
Finally, you can operate with DDL (create, alter, drop) or DML (insert, update, delete, select).
CREATE TABLE test_2 (test int);
TABLE test_2;
Quick tip: With the cursor positioned within the source code and ctrl+enter the sql queries are executed in the IDE.
GL
Upvotes: 2
Reputation: 10355
If you speaking about the code, use SET search_path TO my_schema, public;
If you speaking about the tool, DataGrip, use switcher:
Upvotes: 9