Bug report #22001

DB Manager > History: current_user not written when updating

Added by Paolo Cavallini 6 months ago.

Status:Open
Priority:Normal
Assignee:-
Category:DB Manager
Affected QGIS version:3.4.7 Regression?:No
Operating System:Debian Sid Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:29816

Description

In QGIS 3.4 the Historicization of a table works smoothly, except for the fact that the current_user is added to the table when creating or deleting a feature, but not when updating. Does anyone confirm? I had a look to the function0 but I could not find anything obvious explaining the failure.

[0]
CREATE OR REPLACE FUNCTION "gis"."polygons_update"()
RETURNS TRIGGER AS
$$
BEGIN
IF OLD."time_end" IS NOT NULL THEN
RETURN NULL;
END IF;
IF NEW."time_end" IS NULL THEN
INSERT INTO "gis"."polygons"
("id_0","geom","id","name","area","centroid", "time_start", "time_end")
VALUES
(OLD."id_0",OLD."geom",OLD."id",OLD."name",OLD."area",OLD."centroid",
OLD."time_start", current_timestamp);
NEW."time_start" = current_timestamp;
NEW."ruolo_utente" = current_user;
END IF;
RETURN NEW;
END;
$$
LANGUAGE 'plpgsql';

Also available in: Atom PDF