Bug report #21964

QGIS Server SELECTION doesn't work with Postgres ids of type bigint or text

Added by Éric Lemoine almost 5 years ago.

Status:Open
Priority:High
Assignee:-
Category:QGIS Server
Affected QGIS version:3.7(master) Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:29779

Description

The WMS GetMap SELECTION parameter allows selecting features by their ids. But this may not work on Postgres-based layers depending on the type of the id column and the values for that column.

For example it does not work with id columns of type bigint. This is a major problem as Postgres' row_number() function returns a bigint, and row_number() is very often used when creating views and materialized views.

The problem is related to the selection code calling selectByIds without converting the passed id to an fid. This works correctly for ids of type int when all the ids are positive. But it doesn't work when the id column includes negative values. Nor does it work with id columns of type bigint or text.

I think there should be an idtofid function somewhere, and the selection code calling selectByIds should call that idtofid function prior to calling selectByIds.

Also available in: Atom PDF