In DBeaver, you cannot directly run psql meta-commands, such as \l
, as part of your SQL query. The \l
command is specific to the psql command-line tool and is not recognized by DBeaver.
However, you can achieve the same result in DBeaver by executing a regular SQL query against the PostgreSQL database information schema. The following query will retrieve a list of databases:
SELECT datname FROM pg_database;
To run this query in DBeaver:
- Open a SQL editor in DBeaver.
- Connect to your PostgreSQL database.
- In the SQL editor, enter the query:
SELECT datname FROM pg_database;
. - Execute the query by clicking the “Execute” button or using the keyboard shortcut (e.g., Ctrl+Enter).
DBeaver will execute the query against the PostgreSQL database and display the results in the SQL editor’s result panel. The result will be a list of database names.
By running this query, you can obtain information about databases in PostgreSQL, similar to the \l
command in psql.