Index: trunk/ippTools/src/difftool.c
===================================================================
--- trunk/ippTools/src/difftool.c	(revision 12112)
+++ trunk/ippTools/src/difftool.c	(revision 12131)
@@ -281,6 +281,6 @@
     // constrants
     if (!diffInputSkyfileInsert(config->dbh,
-            (psS32)atoi(diff_id),
-            (psS32)atoi(warp_id),
+            (psS64)atoll(diff_id),
+            (psS64)atoll(warp_id),
             skycell_id,
             tess_id,
@@ -322,6 +322,10 @@
         " JOIN warpInputExp\n"
         "   ON diffInputSkyfile.warp_id    = warpInputExp.warp_id\n"
+        " JOIN camProcessedExp\n"
+        "   ON warpInputExp.cam_id = camProcessedExp.cam_id\n"
+        " JOIN chipProcessedExp\n"
+        "   ON camProcessedExp.chip_id = chipProcessedExp.chip_id\n"
         " JOIN rawExp\n"
-        "   ON warpInputExp.exp_tag        = rawExp.exp_tag\n"
+        "   ON chipProcessedExp.exp_tag = rawExp.exp_tag\n"
         " WHERE\n"
         "   diffRun.state = 'run'\n"
@@ -379,4 +383,10 @@
 
     if (psArrayLength(output)) {
+        if (!convertIdToStr(output)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+            psFree(output);
+            return false;
+        }
+
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "diffInputSkyfile", !simple)) {
@@ -474,4 +484,10 @@
 
     if (psArrayLength(output)) {
+        if (!convertIdToStr(output)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+            psFree(output);
+            return false;
+        }
+
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "diffSkyfile", !simple)) {
@@ -532,5 +548,5 @@
 
     if (!diffSkyfileInsert(config->dbh,
-            (psS32)atoi(diff_id),
+            (psS64)atoll(diff_id),
             uri,
             bg,
@@ -637,4 +653,10 @@
 
     if (psArrayLength(output)) {
+        if (!convertIdToStr(output)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+            psFree(output);
+            return false;
+        }
+
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "diffSkyfile", !simple)) {
