0

Does QGIS have something where I can type a PostGIS query, hit execute and it adds the results as a Layer in QGIS?

I realise I can create a view or table then open it in QGIS, but that becomes painstaking when you're trying out queries like you would with on the command line with psql.

1

As pointed out by @Mapperz, under Database | DB Manager, then connect to your database, then Database | SQL Window.

From there you can enter a query, tick Load as new layer, then click Load.

If you update your query you can hit Load again and this will add a new Layer, you'll need to manually delete the old layer to avoid having all old layers visible.

It's not quite as efficient as the command line, but still faster than the alternative of creating a view with psql then opening it in QGIS.

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.