diff db_schema/lada_data.sql @ 1106:7ea01e09dff4

Fix setting sequences in test data. This did not survive the extinction of the bund schema. Should be safer now by using pg_get_serial_sequence() and the actual maximum of the respecitve ID column.
author Tom Gottfried <tom@intevation.de>
date Wed, 26 Oct 2016 18:54:48 +0200
parents 186d602e031a
children d1d7d684800c
line wrap: on
line diff
--- a/db_schema/lada_data.sql	Wed Oct 26 16:52:45 2016 +0200
+++ b/db_schema/lada_data.sql	Wed Oct 26 18:54:48 2016 +0200
@@ -90,6 +90,10 @@
 
 ALTER TABLE probe ENABLE TRIGGER ALL;
 
+SELECT setval(pg_get_serial_sequence('probe', 'id'),
+    (SELECT max(id) FROM probe));
+
+
 --
 -- TOC entry 4687 (class 0 OID 1170823)
 -- Dependencies: 289
@@ -186,6 +190,10 @@
 
 ALTER TABLE messung ENABLE TRIGGER ALL;
 
+SELECT setval(pg_get_serial_sequence('messung', 'id'),
+    (SELECT max(id) FROM messung));
+
+
 --
 -- TOC entry 4681 (class 0 OID 1170751)
 -- Dependencies: 283
@@ -202,6 +210,10 @@
 
 ALTER TABLE kommentar_m ENABLE TRIGGER ALL;
 
+SELECT setval(pg_get_serial_sequence('kommentar_m', 'id'),
+    (SELECT max(id) FROM kommentar_m));
+
+
 --
 -- TOC entry 4682 (class 0 OID 1170759)
 -- Dependencies: 284
@@ -226,6 +238,10 @@
 
 ALTER TABLE kommentar_p ENABLE TRIGGER ALL;
 
+SELECT setval(pg_get_serial_sequence('kommentar_p', 'id'),
+    (SELECT max(id) FROM kommentar_p));
+
+
 --
 -- TOC entry 4684 (class 0 OID 1170769)
 -- Dependencies: 286
@@ -801,6 +817,10 @@
 
 ALTER TABLE messwert ENABLE TRIGGER ALL;
 
+SELECT setval(pg_get_serial_sequence('messwert', 'id'),
+    (SELECT max(id) FROM messwert));
+
+
 --
 -- TOC entry 4691 (class 0 OID 1170844)
 -- Dependencies: 293
@@ -891,6 +911,10 @@
 
 ALTER TABLE ortszuordnung ENABLE TRIGGER ALL;
 
+SELECT setval(pg_get_serial_sequence('ortszuordnung', 'id'),
+    (SELECT max(id) FROM ortszuordnung));
+
+
 --
 -- TOC entry 4695 (class 0 OID 1170895)
 -- Dependencies: 297
@@ -987,6 +1011,10 @@
 
 ALTER TABLE status_protokoll ENABLE TRIGGER ALL;
 
+SELECT setval(pg_get_serial_sequence('status_protokoll', 'id'),
+    (SELECT max(id) FROM status_protokoll));
+
+
 --
 -- TOC entry 4696 (class 0 OID 1170904)
 -- Dependencies: 298
@@ -1004,6 +1032,9 @@
 
 ALTER TABLE zusatz_wert ENABLE TRIGGER ALL;
 
+SELECT setval(pg_get_serial_sequence('zusatz_wert', 'id'),
+    (SELECT max(id) FROM zusatz_wert));
+
 --
 -- PostgreSQL database dump complete
 --
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)