[Lada-commits] [PATCH] Fix setting sequences in test data

Wald Commits scm-commit at wald.intevation.org
Wed Oct 26 18:55:42 CEST 2016


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1477500888 -7200
# Node ID 7ea01e09dff4cca4b431fb3c0f2be4087fa398bd
# Parent  d9d57a1074781110895c0f79a166390cb7ea8011
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.

diff -r d9d57a107478 -r 7ea01e09dff4 db_schema/lada_data.sql
--- 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
 --


More information about the Lada-commits mailing list