[QGIS-Developer] Bug in DB Manager > Versioning?

Paolo Cavallini cavallini at faunalia.it
Thu Jan 25 11:29:00 PST 2018


Hi all,
the Versioning menu replaces the original primary key with a new one,
leaving the original id as a non PK field:

ALTER TABLE "public"."province_hist" ADD "id_hist" serial, ADD
"time_start" timestamp, ADD "time_end" timestamp;

ALTER TABLE "public"."province_hist" DROP CONSTRAINT
"province_hist_pkey", ADD PRIMARY KEY ("id_hist");

Then it adds only the original id, no PK, and not the new PK to the view:

CREATE VIEW "public"."province_hist_current" AS SELECT
"geom","provincia","id" FROM "public"."province_hist" WHERE "time_end"
IS NULL;

As a result, the view does not have an unique field, and cannot be loaded.
The fix is simple, just adding id_hist to view definition. Am I missing
something, or should I go ahead and fix it?

All the best, and thanks.
-- 
Paolo Cavallini - www.faunalia.eu
QGIS & PostGIS courses: http://www.faunalia.eu/training.html
https://www.google.com/trends/explore?date=all&geo=IT&q=qgis,arcgis


More information about the QGIS-Developer mailing list