Hi all, I've opened issue http://hub.qgis.org/issues/10523 proposing also a solution.
May someone confirm this bug and have a look at the proposed solution? Best regards, Gabriele Monfardini On Thu, Jun 5, 2014 at 11:11 AM, Gabriele Monfardini <[email protected]> wrote: > Hi all, > > in QGIS (trunk updated from git to some days ago, but also in QGIS 2.2 and > 2.0) I have seen a strange behaviour opening a postgis layer in with some > saved styles in table public.layer_styles. > > All styles have useasdefault set to false (these styles only makes sense > within some projects, should not be used as default styles). > > When I open the layer without any project, one of the styles is applied, > in particular the one with update_time more recent. > > The exact query that finds the default style seems to be > > SELECT styleQML FROM layer_styles WHERE f_table_catalog='mydb' AND > f_table_schema='myschema' AND f_table_name='mytable' AND > f_geometry_column='the_geom' ORDER BY CASE WHEN useAsDefault THEN 1 ELSE 2 > END,update_time DESC LIMIT 1 > > > In my opinion rows with useasdefault set to false should be completely > filtered out by the query. > > If all styles have useasdefault set to false, current query retrieves the > most recent style while I think that no rows should be retrieved in this > case and a "random color" style be applied. > > Thus I propose to change the query in > > SELECT styleQML FROM layer_styles WHERE f_table_catalog='mydb' AND > f_table_schema='myschema' AND f_table_name='mytable' AND > f_geometry_column='the_geom' WHERE useAsDefault ORDER BY update_time DESC > LIMIT 1 > > Would you like me to open a bug? > > Regards, > > Gabriele Monfardini > >
_______________________________________________ Qgis-developer mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-developer
