Bug report #20336

Involuntary Feature Filtering

Added by Andrew Fleming over 1 year ago. Updated over 1 year ago.

Status:Feedback
Priority:Normal
Assignee:-
Category:Data Provider/Oracle
Affected QGIS version:3.6.0 Regression?:Yes
Operating System:Windows 7 Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:28157

Description

Hi everyone,

When I load a polygon feature from my Oracle Database into QGIS 3.2.4 & 3.4 (Using Windows 7), the polygon records are filtered in the attribute table.

Please see

If I search for one of the hidden features using an Advanced Filter, I can find the feature successfully but the attribute table loads a completely different feature with entirely different attributes.

Please see

Strangely, if I pan / zoom the map view to this 'wrong' record, the map extent goes to the one I originally intended to find.

Please see

I don't have the same issue if I load the feature as a shapefile or perform the same feature load in the last QGIS LTR (2.18). I tried to research this topic a little bit but could not find a solution to the problem. I'm hoping someone can help. Just an FYI, this is my first time submitting a Bug report so my apologies if I've broken any reporting rules or omitted information.

Thanks,
Andrew

Filtered Records 1.JPG (29.4 KB) Andrew Fleming, 2018-11-02 07:33 PM

Filtered Records 2.JPG (39.7 KB) Andrew Fleming, 2018-11-02 07:36 PM

Filtered Records 3.JPG (120 KB) Andrew Fleming, 2018-11-02 07:42 PM

Data Source Image (3.2).JPG (103 KB) Andrew Fleming, 2018-11-05 03:46 PM

History

#1 Updated by Giovanni Manghi over 1 year ago

  • Status changed from Open to Feedback

Are you using a configuration like "show only visible features"?

Did it worked on 2.18?

Does it happens only with Oracle or also other data sources?

#2 Updated by Harrissou Santanna over 1 year ago

  • Regression? changed from No to Yes

Just an FYI, this is my first time submitting a Bug report so my apologies if I've broken any reporting rules or omitted information.

@Andrew for a first report, this is rather well described imho.
For completeness, can you check as suggested by Giovanni what's set for Preferences --> Settings --> Data sources --> Attribute table behavior? This will let know whether the initial filtering is normal or not.

#3 Updated by Andrew Fleming over 1 year ago

Thanks for your help so far friends. I attached a screenshot of my Data Sources for your review. 'Attribute table behaviour' is set to 'Show all features'.

Please see !/attachments/download/13684/Data%20Source%20Image%20(3.2).JPG!

Sorry, I realized I forgot to respond to Giovanni. This filtering does not happen in 2.18 and the Data Sources settings are the same.

#4 Updated by Andrew Fleming over 1 year ago

Hello all,

For anyone that happens to stumble onto this, I figured out how resolve this issue. To prevent QGIS from what I describe as 'Involuntary' filtering (or the phenomena where extra features are automatically added outside your Selection Area), you must establish the primary key of your table IN QGIS.

To accomplish this:

1) Open the DB Manager,
2) Select your layer in the respective schema
3) Select the primary key column in the 'Column with unique values' dropdown list.
4) Click Update. (and don't forget to save your workspace)

or alternatively, you can:

1) Add your affected layer to a workspace,
2) Right-click on it in the Layers panel,
3) Left-click 'Update SQL Layer'
4) Follow steps 3 and 4 above.

I initially thought QGIS captured the primary key automatically from the indexes in your database, but clearly this is not always the case. I hope someone else finds this useful.

Thanks,
Andrew

#5 Updated by Giovanni Manghi over 1 year ago

To accomplish this:

1) Open the DB Manager,
2) Select your layer in the respective schema
3) Select the primary key column in the 'Column with unique values' dropdown list.
4) Click Update. (and don't forget to save your workspace)

is this a thing only for Oracle layers?

or alternatively, you can:

1) Add your affected layer to a workspace,
2) Right-click on it in the Layers panel,
3) Left-click 'Update SQL Layer'
4) Follow steps 3 and 4 above.

this is about a query layer (from Oracle?)?

#6 Updated by Andrew Fleming over 1 year ago

Hi Giovanni,

Yes, the aforementioned issues are related to Oracle layers brought into QGIS.

#7 Updated by Giovanni Manghi over 1 year ago

  • Category changed from Attribute table to Data Provider/Oracle

#8 Updated by Giovanni Manghi over 1 year ago

Andrew Fleming wrote:

Hi Giovanni,

Yes, the aforementioned issues are related to Oracle layers brought into QGIS.

can you set the most recent version where you observed it?

#9 Updated by Andrew Fleming over 1 year ago

The filtering / selection issue is present in 3.6.0 (and all previous version 3 releases).

Unfortunately, updating the 'Column with unique values' field in the DB manager is now preventing me from editing the oracle table. Perhaps I'm doing something incorrectly?

#10 Updated by Giovanni Manghi over 1 year ago

  • Affected QGIS version changed from 3.4.0 to 3.6.0

Andrew Fleming wrote:

The filtering / selection issue is present in 3.6.0 (and all previous version 3 releases).

Unfortunately, updating the 'Column with unique values' field in the DB manager is now preventing me from editing the oracle table. Perhaps I'm doing something incorrectly?

I don't have an Oracle backend I can use to try this scenario.

#11 Updated by Jürgen Fischer over 1 year ago

  • Description updated (diff)

Also available in: Atom PDF