[QGIS-Developer] DB Manager > History: current_user not written when updating

Paolo Cavallini cavallini at faunalia.it
Sat May 4 23:45:45 PDT 2019


Hi all,
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 function[0] but I could not find anything obvious explaining
the failure.
Thanks for feedback.

[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';
-- 
Paolo Cavallini - www.faunalia.eu
QGIS.ORG Chair:
http://planet.qgis.org/planet/user/28/tag/qgis%20board/


More information about the QGIS-Developer mailing list