Changes between Version 5 and Version 6 of UsersWikiQGIS


Ignore:
Timestamp:
May 25, 2017, 9:41:01 AM (7 years ago)
Author:
jgh
Comment:

Fix issue with on the fly unique ID generation as current solution can cause the same ID to be assigned to different rows in different queries, effectively desynchronizing geometries and attributes in some application (QGIS)

Legend:

Unmodified
Added
Removed
Modified
  • UsersWikiQGIS

    v5 v6  
    7676When you don't have a unique id for each row you want to display, you can create on on the fly using the SQL windows to load your geometries.
    7777Simply add in the select :
    78 `SELECT row_number() OVER() AS id_qgis` , and select id_qgis as the id column in the QGIS list.
     78`SELECT row_number() OVER( ORDER BY field1,field2 ) AS id_qgis` , and select id_qgis as the id column in the QGIS list. It is necessary to specify the Order By clause to ensure the same ID is always assigned to the same row, for every query, regardless of the usage of fields and joins that do affect the row order in the result set.