Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styles in database not working for postgres provider and non-geometric layers #44749

Closed
ygversil opened this issue Aug 18, 2021 · 1 comment · Fixed by #45075
Closed

Styles in database not working for postgres provider and non-geometric layers #44749

ygversil opened this issue Aug 18, 2021 · 1 comment · Fixed by #45075
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Symbology Related to vector layer symbology or renderers

Comments

@ygversil
Copy link

What is the bug or the crash?

After saving a style into the database for a PostgreSQL layer with no geometry, QGIS is not able to list the style and to load it back.

Steps to reproduce the issue

  1. Look for a table in a PostgreSQL database which has no geometry and load it into QGIS.
  2. Go to the Layer property window, in any style tab click on the Style button at the bottom, and select Save style....
  3. In the drop down list, select In database (postgres), give name Foo, and click OK to save style.
  4. Optionally check that a new line has been inserted in the public.layer_styles table in PostgreSQL for the style Foo.
  5. Click again on the Style button at the bottom, and select Load style....
  6. In the drop down list, select From database (postgres).

The group for styles related to current layer is empty. It should have shown the Foo style.

Versions

Version de QGIS | 3.20.1-Odense | Branche de code de QGIS | Release 3.20
Version de Qt | 5.15.2
Version de Python | 3.9.6
Version de GDAL/OGR | 3.3.1
Version de Proj | 8.0.1
Version de la base de données du registre EPSG | v10.018 (2021-04-02)
Version de GEOS | 3.9.1-CAPI-1.14.2
Version de SQLite | 3.36.0
Version de PDAL | 2.3.0
Version du client PostgreSQL | 13.3
Version de SpatiaLite | 5.0.1
Version de QWT | 6.1.6
Version de QScintilla2 | 2.13.0
Version de l'OS | Arch Linux
Extensions Python actives | csv_toolslizmapqfieldsyncpg_metadatarelation_batchinsertAppendFeaturesToLayergeometry_pasterscriptrunner3ana_database_extractguided_offline_editingtaxref_apilatlontoolsMetaSearchprocessingdb_manager

Additional context

I believe the reason is that the SELECT query to list styles in database use a f_geometry_column = NULL filter, which should be instead for PostgreSQL f_geometry_column is null.

@ygversil ygversil added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Aug 18, 2021
@gioman gioman added the Symbology Related to vector layer symbology or renderers label Aug 18, 2021
@CoryAlbrecht
Copy link

I've noticed recently that QGIS is not saving any style changes for my projects that are saved in the database. I have multiple layer styles saved because what is easiest to work with is not what I want to export to SVG for artistic work, and when I change a layer's style, save the project, close QGIS, and reopen everything, the layer style is what it was before the change.

Could that be related to this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Symbology Related to vector layer symbology or renderers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants