Thanks to both Jorge and Luigi,

The queries received by postgresql are below

The core problem seems to be that f_table_catalog is populated as a NULL rather than the database name.
Ironically it appears that loading would still work but it fails as  " f_table_catalog=NULL" is the incorrect syntax and needs to be " f_table_catalog  IS NULL"

Afraid my python skills aren't well enough developed to determine why the database name is not being passed through to the queries.

I attempted to register the issue as a QGIS bug, but it's not readily apparent how to register as a new user.

Tony



Saving a style
2017-01-15 17:42:56 ACDT [18200-13] tonbaz@tonbaz LOG:  statement: SELECT COUNT(*) FROM information_schema.tables WHERE table_name='layer_styles'
2017-01-15 17:42:56 ACDT [18200-14] tonbaz@tonbaz LOG:  statement: SELECT styleName FROM layer_styles WHERE f_table_catalog=NULL AND f_table_schema='public' AND f_table_name='g_parepg_polygons' AND f_geometry_column='geom' AND styleName='test01'
2017-01-15 17:42:56 ACDT [18200-15] tonbaz@tonbaz LOG:  statement: INSERT INTO layer_styles(f_table_catalog,f_table_schema,f_table_name,f_geometry_column,styleName,styleQML,styleSLD,useAsDefault,description,owner) VALUES (NULL,'public','g_parepg_polygons','geom','test01',XMLPARSE(DOCUMENT '<!DOCTYPE qgis PUBLIC ''http://mrcc.com/qgis.dtd'' ''SYSTEM''>

loading a style
2017-01-15 17:45:06 ACDT [18235-13] tonbaz@tonbaz LOG:  statement: SELECT id,styleName,description FROM layer_styles WHERE f_table_catalog=NULL AND f_table_schema='public' AND f_table_name='g_parepg_polygons' AND f_geometry_column='geom'
2017-01-15 17:45:06 ACDT [18235-14] tonbaz@tonbaz LOG:  statement: SELECT id,styleName,description FROM layer_styles WHERE NOT (f_table_catalog=NULL AND f_table_schema='public' AND f_table_name='g_parepg_polygons' AND f_geometry_column='geom') ORDER BY update_time DESC


On 13/01/17 20:46, Jorge Gustavo Rocha wrote:
Hi Tony,

If you can see the styles in later_styles table, you can try to run the
two queries executed by QGIS to populate the dialog. The first is for
the styles associated with the layer. The later is for all other styles.

-- replace 'publica' with your database
-- replace 'pdm11_c_geral' with your schema
-- replace 'ran' with your table name
-- replace 'the_geom' with your geometry column

SELECT id,styleName,description
FROM layer_styles
WHERE f_table_catalog='publica' AND f_table_schema='pdm11_c_geral' AND
f_table_name='ran' AND f_geometry_column='the_geom'

SELECT id,styleName,description
FROM layer_styles
WHERE NOT (f_table_catalog='publica' AND f_table_schema='pdm11_c_geral'
AND f_table_name='ran' AND f_geometry_column='the_geom')
ORDER BY update_time DESC

Did these queries returned the any styles?

You can log your own Postgresql queries to check what is going on.

Regards,

Jorge Gustavo

Às 02:23 de 13-01-2017, Tony Bazeley escreveu:
Hi,

I'm having some trouble attempting to work with styles in postgresql.

I can successfully save a style to the database - table layer_styles is
created and populated.
But attempting to load brings up the 'Load Style from database dialog'
with messages "No styles found in database'

Am using QGIS 2.18.2 with postgresql 9.6 and postgis 2.3

Would appreciate any thoughts on how to progress.

Thanks
Tony



_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user

J. Gustavo


_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to