qwat / pg-history-viewer

QGIS plugin that helps visualize contents of a PostgreSQL audit trigger table
16 stars 7 forks source link

The "Feature ID" history filter does not work when the PK is not called "id" #29

Open autra opened 3 years ago

autra commented 3 years ago

Steps

expected: the changes are shown

actual: nothing is shown. and on the database log I can see the plugin tries to filter with id. Ex query:

2021-08-27 15:49:44.558 CEST [811474] postgres@cadastre LOG:  statement: SELECT event_id, action_tstamp_clk, schema_name || '.' || table_name, action, application_name, session_user_name, row_data, changed_fields FROM audit.logged_actions l WHERE schema_name = 'public' AND table_name = 'batiments3' AND row_data->'id'='28104' AND action IN ('I','U','D') ORDER BY action_tstamp_clk DESC

(the pk is called ogc_fid in my case)

Proposed solutions

The audit table keeps track of the pk name, let's use it to filter, instead of id.

ponceta commented 1 year ago

This is a bug for TEKSI module wastewater (QGEP) where id are store under the field obj_id.