[Qgis-developer] Postgres provider checks queries and refuses CTE
Sandro Santilli
strk at keybit.net
Tue Jul 10 09:06:04 PDT 2012
+1 for dropping the filter -- trust the user ! --strk;
On Tue, Jul 10, 2012 at 05:10:23PM +0200, Vincent Picavet wrote:
> 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...
More information about the Qgis-developer
mailing list