Bug report #17234

Saving style in postgres database can't be restored when connection uses a service file

Added by Regis Haubourg about 7 years ago. Updated about 7 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Symbology
Affected QGIS version:2.18.13 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:25133

Description

When saving a style to a database, using a service file, I can't restore it when opening a datasource.

When saving a style with classic authetication, I have this in the PG logs

BEGIN; UPDATE layer_styles SET useAsDefault=false WHERE f_table_catalog='refgeo2' AND f_table_schema='dce' AND f_table_name='sousbassin_dce' AND f_geometry_column='geoml93hydro'; INSERT INTO layer_styles(f_table_catalog,f_table_schema,f_table_name,f_geometry_column,styleName,styleQML,styleSLD,useAsDefault,description,owner) VALUES ('refgeo2','dce','sousbassin_dce','geoml93hydro','my_new_style',XMLPARSE(DOCUMENT '<!DOCTYPE qgis PUBLIC ''http://mrcc.com/qgis.dtd'' ''SYSTEM''>
    <qgis version="2.18.12" simplifyAlgorithm="0" minimumScale="0" maximumScale="1e+08" simplifyDrawingHints="1" minLabelScale="0" maxLabelScale="1e+08" simplifyDrawingTol="1" readOnly="0" simpli 
[.... snip] 
    '),true,'my style desc',NULL); COMMIT;

When saving with a service file, the dialog asking if I want to save the style as default and with a name does not show up.
And the logged query is:

BEGIN; UPDATE layer_styles SET useAsDefault=false WHERE f_table_catalog=NULL AND f_table_schema='dce' AND f_table_name='sousbassin_dce' AND f_geometry_column='geoml93hydro'; INSERT INTO layer_styles(f_table_catalog,f_table_schema,f_table_name,f_geometry_column,styleName,styleQML,styleSLD,useAsDefault,description,owner) VALUES (NULL,'dce','sousbassin_dce','geoml93hydro','sousbassin_dce',XMLPARSE(DOCUMENT '<!DOCTYPE qgis PUBLIC ''http://mrcc.com/qgis.dtd'' ''SYSTEM''>
    <qgis version="2.18.12" simplifyAlgorithm="0" minimumScale="0" maximumScale="1e+08" simpli
[...snip]
    '),true,'lun. oct. 2 18:55:02 2017',NULL); COMMIT;

I see two issues:

1- the Update clause should not be done in case of first style saving for that table
2- f_table_catalog is filled with a NULL value. When trying to load the style afterward, the where f_table_catalog is turned into "f_table_catalog =NULL" which returns no values.

Anyone knows why the f_table_catalog is not accessible to QGIS in case of service file connection?
Jürgen Maybe?

Associated revisions

Revision 924ce817
Added by Paul Blottiere about 7 years ago

Fixes #17234 save/load styles from Postgres when a service file is used

Revision d4635d04
Added by Matthias Kuhn about 7 years ago

Merge pull request #5317 from pblottiere/bugfix_style

[bugfix] Fixes #17234 save/load styles from Postgres when a service file is used

Revision ac5d0f80
Added by Paul Blottiere about 7 years ago

Fixes #17234 save/load styles from Postgres when a service file is used

Revision 29a137d5
Added by Paul Blottiere about 7 years ago

Merge pull request #5381 from pblottiere/bugfix_style_218

[bugfix] Fixes #17234 save/load styles from Postgres when a service file is used

History

#1 Updated by Paul Blottiere about 7 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

Also available in: Atom PDF