Hi Paolo,

On Thu, 25. Jan 2018 at 20:29:00 +0100, Paolo Cavallini wrote:
> 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.

id should still be unique for all current rows, shouldn't it?  So you just have
to specify that id is the key (would be the same with id_hist).


Jürgen

-- 
Jürgen E. Fischer           norBIT GmbH             Tel. +49-4931-918175-31
Dipl.-Inf. (FH)             Rheinstraße 13          Fax. +49-4931-918175-50
Software Engineer           D-26506 Norden             http://www.norbit.de
QGIS release manager (PSC)  Germany                    IRC: jef on FreeNode

Attachment: signature.asc
Description: PGP signature

_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to