Skip to content

Plugin fails to process layers after encountering complex SQL view layers #21

@bbscout

Description

@bbscout

Description:
When working with multiple PostGIS layers in QGIS project, the plugin stops processing layers at the point where it encounters layers based on complex SQL views (WITH clause, window functions, etc.).

Steps to reproduce:

  1. Create a QGIS project with mixture of:
    • Regular PostGIS layers (table-based)
    • PostGIS layers based on complex SQL views (using WITH clause, window functions, ST_Buffer, etc.)
  2. Open changeDataSource plugin
  3. Try to change datasource for all layers

Current behavior:

  • Plugin only shows and processes layers up to the first SQL view layer
  • When trying to process selected layers after SQL view layer, it throws error:
Traceback (most recent call last):
File ".../changeDataSource.py", line 385, in replaceDS
scope.setFeature(next(self.layersPropLayer.getFeatures(QgsFeatureRequest(row+1))))
StopIteration

Expected behavior:

  • Plugin should either:
    a) Handle SQL view layers correctly, or
    b) Skip SQL view layers but continue processing subsequent layers, or
    c) Show clear warning that SQL view layers are not supported

Example of problematic layer source:

table="(SELECT row_number() OVER () AS fid, * FROM ( WITH dissolved AS (...) SELECT ..., ST_Buffer((ST_Dump(merged_geom)).geom,0) AS geom FROM dissolved) AS _subq_1_)"

Environment:

QGIS version: 3.34.0-Prizren
Plugin version: 3.1
OS: Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions