Re: [Qgis-user] Load Style from database dialog is blank

2017-01-15 Thread Tony Bazeley

  
  
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
'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

Re: [Qgis-user] Load Style from database dialog is blank

2017-01-13 Thread Jorge Gustavo Rocha
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
-- 
Jorge Gustavo Rocha
Departamento de Informática
Universidade do Minho
4710-057 Braga
Tel: +351 253604480
Fax: +351 253604471
Móvel: +351 910333888
skype: nabocudnosor
___
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

Re: [Qgis-user] Load Style from database dialog is blank

2017-01-13 Thread Luigi Pirelli
As noticed in dev list, that part of code has a lack of detailed error
message, and community is working on it. In the meanwhile, I can only
suggest to:

1) check log panel
2) check server messages
3) use a qgis "with debug" version and setup QGIS_DEBUG var to see more messages

probably the point 2 is enough

btw from a postgres client, try the same query done by the postgres provider:
https://github.com/qgis/QGIS/blob/master/src/providers/postgres/qgspostgresprovider.cpp#L4544

look in the same code for saveStyle method to understand how the table
is created.

regards
Luigi Pirelli

**
* Boundless QGIS Support/Development: lpirelli AT boundlessgeo DOT com
* LinkedIn: https://www.linkedin.com/in/luigipirelli
* Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
* GitHub: https://github.com/luipir
* Mastering QGIS 2nd Edition:
* 
https://www.packtpub.com/big-data-and-business-intelligence/mastering-qgis-second-edition
**


On 13 January 2017 at 03:23, Tony Bazeley  wrote:
> 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
___
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