[Qgis-user] Can't use Postgres WITH clause (Common Table Expressions) in DBManager in QGIS 1.8

Alexandre Neto senhor.neto at gmail.com
Wed Feb 6 04:42:33 PST 2013


I'm trying to use Postgresql 9.2 Commom Table
Expressions<http://www.postgresql.org/docs/9.2/static/queries-with.html>
in
queries that will be loaded in QGIS 1.8 (windows vista) using DBManager.

Here's a very simple (and useless) example:

WITH query_1 as (

    SELECT *

    FROM "PDM".pdm_compare)

SELECT *

FROM query_1

In DBManager SQLWindow, I'm able to execute and see the table results, but
when I try to load it QGIS Canvas (selecting the Id and geometry columns),
I got the following error in the postgis warning tab:

Erroneous query: SELECT * FROM "(WITH query_1 as (
SELECT *
FROM ""PDM"".pdm_compare)
SELECT *
FROM query_1
)" LIMIT 1 returned 7 [ERROR:  relation "(WITH query_1 as (
SELECT *
FROM "PDM".pdm_compare)
SELECT *
" does not exist
LINE 1: SELECT * FROM "(WITH query_1 as (
                      ^
]

I tried using qgis 1.9 and I was able to load the query. Is this a known
problem in 1.8? Is there a workaround so I can use WITH statements in QGIS
1.8.

Thanks,

Alexandre Neto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20130206/3b4fdf54/attachment.html>


More information about the Qgis-user mailing list