Hi,
The postgres provider apparently does a check on the input query and only 
tolerates queries beginning with "SELECT".

The more general SQL query form allows for queries not beginning with select, 
but still being valid, as it is the case for CTEs. The only way to have qgis 
load them is to wrap CTEs inside a select, which is not really nice.

Example.
This won't load in qgis :

with points as (select gid, st_makepoint(random() * 10, random() * 10) as 
the_geom from generate_series(1, 100) as gid) select * from points

But this will :

select * from (with points as (select gid, st_makepoint(random() * 10, 
random() * 10) as the_geom from generate_series(1, 100) as gid) select * from 
points) as foo

This is also the case for other kind of queries like UPDATE... RETURNING, 
which should be valid but don't conform to the filter.

Is the filter useful anyway, since there are so many ways to write non-valid 
queries ?

So the question is : do we get rid of the SELECT filter in postgres provider ? 

Those in favor of keeping it raise your hands and arguments now, or I think 
we'd better drop it...

Vincent
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to