Bug report #1987

Layer with partial unique index are wrong handeld

Added by cmoe - almost 10 years ago. Updated almost 10 years ago.

Status:Closed
Priority:Low
Assignee:nobody -
Category:Data Provider
Affected QGIS version: Regression?:No
Operating System:RedHat Easy fix?:No
Pull Request or Patch supplied: Resolution:fixed
Crashes QGIS or corrupts data: Copied to github as #:12047

Description

If you have a postgis point table with a partial unique index like

CREATE UNIQUE INDEX foo_bar_unique_idx
  ON foo
  USING btree
  (bar)
  WHERE archive = 0;

it looks like qgis isn't using the primary key of the table but the partial unique index. The index though isn't unique. It's only unique for the rows in the where condition.

The following problems I detected on such a table:
- the attribute table fails on sorting
- the identify tool sometimes marks a false point
- the select tool selects more as the expected points
- if you edit an affected point, the false point/row is edited

I only tested for a point layer. Maybe there is the same issue with lines and polygons.

Attached is a dump of a sample table with 3 points and a partial index that leads to the problems here. I may provide other/bigger sample data if necessary.

sample_table.sql - sample table with 3 points and partial unique index (1.98 KB) cmoe -, 2009-10-09 05:42 AM

Associated revisions

Revision 5920feb4
Added by Jürgen Fischer almost 10 years ago

fix #1987

git-svn-id: http://svn.osgeo.org/qgis/trunk/[email protected] c8812cc2-4d05-0410-92ff-de0c093fc19c

Revision 9037374d
Added by Jürgen Fischer almost 10 years ago

fix #1987

git-svn-id: http://svn.osgeo.org/qgis/[email protected] c8812cc2-4d05-0410-92ff-de0c093fc19c

History

#1 Updated by Jürgen Fischer almost 10 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

fixed in 9037374d (SVN r11785)

Also available in: Atom PDF