3

When I add a new PostGIS database connection to QGIS the dialog asks for the database name.

At times I want to add a database and can't remember the exact name or I want to add a database from a different server and I'm not sure what databases are available.

Is there a way to list all databases on a server within QGIS? I know I could look this information up in pgAdmin but I'd prefer to keep it within QGIS.

  • I don't think you can do it in Add PostGIS Layers..., but you can go to DB Manager, connect to a known db and run the following query SELECT datname FROM pg_database WHERE datistemplate = false;. It will list all the databases on the server. But I guess your question is more about being able to see the databases in the Add Layers window. – thibautg Sep 11 '17 at 16:11
1

As far as I'm aware, this isn't an option directly available in QGIS.

According to Displaying PostGIS geometries using QGIS

The workflow is always identical. The first time, you have to define a connection to PostGIS database ((default values are : host:localhost , port:5432 , Database:postgres)). Then you will load a PostGIS table containing a geometry column as a new QGIS layer. Then this layer can be edited, and you have access to all the other columns (if the type is known by QGIS, else cast to ::text), for example to use it as a color categories, or as proportion field, etc.

QGIS documentation Module: Using Spatial Databases in QGIS¶ doesn't refer to listing of database prior to connection as well. Just directly connect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.