[dataimport] massive_store: do not drop constraints with `cascade` since it breaks things
authorSamuel Trégouët <samuel.tregouet@logilab.fr>
Tue, 15 Dec 2015 10:13:55 +0100
changeset 11021 91db22bb8d29
parent 11020 c8c8f6a6147f
child 11022 1032d7956b11
[dataimport] massive_store: do not drop constraints with `cascade` since it breaks things We want to be able to restore constraints at the end of the import. If they are silently dropped due to a CASCADE, we can't do that.
dataimport/massive_store.py
--- a/dataimport/massive_store.py	Mon Dec 21 12:16:12 2015 +0100
+++ b/dataimport/massive_store.py	Tue Dec 15 10:13:55 2015 +0100
@@ -332,7 +332,7 @@
         for name, query in constraints.items():
             sql = 'INSERT INTO cwmassive_constraints VALUES (%(e)s, %(c)s, %(t)s)'
             self.sql(sql, {'e': tablename, 'c': query, 't': 'constraint'})
-            sql = 'ALTER TABLE %s DROP CONSTRAINT %s CASCADE' % (tablename, name)
+            sql = 'ALTER TABLE %s DROP CONSTRAINT %s' % (tablename, name)
             self.sql(sql)
         for name, query in indexes.items():
             sql = 'INSERT INTO cwmassive_constraints VALUES (%(e)s, %(c)s, %(t)s)'