Bug report #21964
QGIS Server SELECTION doesn't work with Postgres ids of type bigint or text
|Affected QGIS version:
|Pull Request or Patch supplied:
|Crashes QGIS or corrupts data:
|Copied to github as #:
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.