Update tablecopy tool: Add --disable-triggers option.
--- a/tablecopy.py Thu Mar 20 16:33:34 2014 +0100
+++ b/tablecopy.py Mon Apr 14 22:28:12 2014 +0200
@@ -23,6 +23,8 @@
help="Do nothing, just print tables to be copied. Useful in combination with --regex.")
self.parser.add_argument('--no-sort', dest='nosort', action='store_true',
help="Do not sort. By default, tables are sorted by foreign key references.")
+ self.parser.add_argument('--disable-triggers', dest='notriggers', action='store_true',
+ help="Disable all triggers for the session.")
self.init()
@@ -30,6 +32,12 @@
self.srcconn = self.pgm.get_conn('src')
self.dstconn = self.pgm.get_conn('dst')
+ if self.args.notriggers:
+ curs = self.dstconn.cursor()
+ curs.execute('SET session_replication_role = replica;')
+ curs.close()
+ self.dstconn.commit()
+
dc = pgdatacopy.PgDataCopy(self.srcconn, self.dstconn)
if self.args.nosort: