Index: trunk/ippToPsps/jython/stackbatch.py
===================================================================
--- trunk/ippToPsps/jython/stackbatch.py	(revision 35222)
+++ trunk/ippToPsps/jython/stackbatch.py	(revision 35417)
@@ -543,6 +543,18 @@
         # response = raw_input("updated dvo ")
         
+        # XXX EAM : note that in mysql versions later than 5.1, this fails
+        # unless the following is called first: 
+        # set session old_alter_table=1
+        # follow the command with 
+        # set session old_alter_table=0
+        # OF COURSE, this fails for mysql version < 5.5...
+        if self.scratchDb.version > 5.1:
+            self.scratchDb.execute("set session old_alter_table=1")
+
         sql = "ALTER IGNORE TABLE StackDetection ADD PRIMARY KEY (objID)"
         
+        if self.scratchDb.version > 5.1:
+            self.scratchDb.execute("set session old_alter_table=0")
+
         self.scratchDb.execute(sql)
         # response = raw_input("add primary key? ")
@@ -806,10 +818,17 @@
          ON (a.stackDetectID = b.detectID) where b.imageID = " + str(imageID) + \
          " INTO OUTFILE '" + dumpFile + "'"
-        print "sql: ", sql
-        self.scratchDb.execute(sql)
+
+        try: self.scratchDb.execute(sql)
+        except:
+            self.logger.info("failed to select data for stackDetectionCalib")
+            self.logger.infoPair("sql: ", sql)
+            raise
 
         sql = "LOAD DATA INFILE '" + dumpFile + "' INTO TABLE " + tableName
-        print "sql: ", sql
-        self.scratchDb.execute(sql)
+        try: self.scratchDb.execute(sql)
+        except:
+            self.logger.info("failed to load data from infile for stackDetectionCalib")
+            self.logger.infoPair("sql: ", sql)
+            raise
 
         ## XXX write this with the select/insert
