Opened 15 years ago

Closed 15 years ago

#1987 closed bug (fixed)

Layer with partial unique index are wrong handeld

Reported by: cmoe Owned by: nobody
Priority: critical: causes crash or data corruption Milestone: Version 1.4.0
Component: Data Provider Version: Trunk
Keywords: Cc:
Must Fix for Release: Yes Platform: RedHat
Platform Version: Awaiting user input: no

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.

Attachments (1)

sample_table.sql (2.0 KB ) - added by cmoe 15 years ago.
sample table with 3 points and partial unique index

Download all attachments as: .zip

Change History (2)

by cmoe, 15 years ago

Attachment: sample_table.sql added

sample table with 3 points and partial unique index

comment:1 by jef, 15 years ago

Resolution: fixed
Status: newclosed

fixed in r11784

Note: See TracTickets for help on using tickets.