Opened 13 years ago

Closed 13 years ago

#1933 closed bug (fixed)

Fix PostGIS dataprovider to check for unique data with SQL where clause

Reported by: jpalmer Owned by: jef
Priority: major: does not work as expected Milestone:
Component: Data Provider Version: Trunk
Keywords: postgis, postgresql Cc:
Must Fix for Release: No Platform: All
Platform Version: WinXP SP2 Awaiting user input: no

Description

The method QgsPostgresProvider::uniqueData within qgspostgresprovider.cpp should be updated to use the SQL where cause for determining if the set primary key provides unique data.

i.e

  if ( !sqlWhereClause.isEmpty() )
  {
    sql += " where " + sqlWhereClause;
  }

Change History (4)

comment:1 by jef, 13 years ago

Resolution: wontfix
Status: newclosed

the where clause can be changed later, to the id needs to be unique even without the where clause. An alternative would be to create a view with the desired clause.

comment:2 by jef, 13 years ago

s/to/so/

comment:3 by jpalmer, 13 years ago

Resolution: wontfix
Status: closedreopened

The case I was wanting to implement already involves a view. It would be useful to use the where cause to show different spatial datasets based on this view.

How about modifying the QgsPostgresProvider::setSubsetString method to recheck for the unique primary key by calling the QgsPostgresProvider::uniqueData() method?

I would be really great to have this feature so I can build a python plug-in to dynamically add and view multiple vector layers based on a dataset identifier.

in reply to:  3 comment:4 by jef, 13 years ago

Resolution: fixed
Status: reopenedclosed

Replying to jpalmer:

How about modifying the QgsPostgresProvider::setSubsetString method to recheck for the unique primary key by calling the QgsPostgresProvider::uniqueData() method?

good point. Thanks.

Fixed in r11703

Note: See TracTickets for help on using tickets.