enricofer / postgisQueryBuilder

6 stars 3 forks source link

wrong query #8

Closed gioman closed 10 years ago

gioman commented 10 years ago

it seems there is something off with the query creating. For example I want to do the buffer of a layer called "habi1" that is in the schema "testes" with a "geom" geometry column. The result is

CREATE VIEW "_Buffer_of_habi1" AS SELECT "habi1".geom, "habi1".id, row_number() OVER () AS ogc_fid, ST_Buffer("habi1".the_geom,2000::double precision) AS the_geom FROM "habi1"

but should be

CREATE VIEW "_Buffer_of_habi1" AS SELECT testes."habi1".geom, testes."habi1".id, row_number() OVER () AS ogc_fid, ST_Buffer(testes."habi1".geom,2000::double precision) AS the_geom FROM testes."habi1"

or with aliases

CREATE VIEW "_Buffer_of_habi1" AS SELECT a.geom, a.id, row_number() OVER () AS ogc_fid, ST_Buffer(a.geom,2000::double precision) AS the_geom FROM testes."habi1" a

as user I would also expect that the result is places in the same schema as input layer(s)

CREATE VIEW testes."_Buffer_of_habi1" AS SELECT a.geom, a.id, row_number() OVER () AS ogc_fid, ST_Buffer(a.geom,2000::double precision) AS the_geom FROM testes."habi1" a

I would also don't see the reason to put in the result also the original geometry column (maybe as an option)

CREATE VIEW testes."_Buffer_of_habi1" AS SELECT a.id, row_number() OVER () AS ogc_fid, ST_Buffer(a.geom,2000::double precision) AS geom FROM testes."habi1" a

cheers!

enricofer commented 10 years ago

Added schema in sql definition. key and geometry field are added by default as stupid-proof solution to ensure qgis layer visualization. Thanks for your interest!

gioman commented 10 years ago

Thanks! will test asap.