Index: trunk/ippTools/src/staticskytool.c
===================================================================
--- trunk/ippTools/src/staticskytool.c	(revision 28146)
+++ trunk/ippTools/src/staticskytool.c	(revision 28154)
@@ -42,4 +42,6 @@
 static bool importrunMode(pxConfig *config);
 
+static bool setstaticskyRunState(pxConfig *config, psS64 sky_id, const char *state);
+
 # define MODECASE(caseName, func) \
     case caseName: \
@@ -129,4 +131,5 @@
     PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
     PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false);
+    PXOPT_LOOKUP_BOOL(check_inputs, config->args, "-check_inputs", false);
 
     psString select = pxDataGet("staticskytool_definebyquery_select.sql");
@@ -255,4 +258,16 @@
 	    psWarning("staticskytool ERROR: no rows found for known tess_id, skycell_id?");
 	    continue;
+	}
+
+	if (check_inputs) {
+	  // negative simple so the default is true
+	  if (!ippdbPrintMetadatas(stdout, inputs, "staticskyInput", !simple)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to print array");
+            psFree(output);
+            psFree(where);
+            return false;
+	  }
+	  psFree(inputs);
+	  continue;
 	}
 
@@ -550,4 +565,14 @@
     }
 
+    if (!fault) {
+        if (!setstaticskyRunState(config, sky_id, "full")) {
+            if (!psDBRollback(config->dbh)) {
+                psError(PS_ERR_UNKNOWN, false, "database error");
+            }
+            psError(PS_ERR_UNKNOWN, false, "failed to change staticskyRun state");
+            return false;
+        }
+    }
+
     // point of no return
     if (!psDBCommit(config->dbh)) {
@@ -643,9 +668,8 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-# if (0)
     psMetadata *where = psMetadataAlloc();
-    PXOPT_COPY_S64(config->args, where, "-stack_id", "stackSumSkyfile.stack_id", "==");
-    pxAddLabelSearchArgs(config, where, "-label", "stackRun.label", "==");
-    PXOPT_COPY_S16(config->args, where, "-fault", "stackSumSkyfile.fault", "==");
+    PXOPT_COPY_S64(config->args, where, "-sky_id", "staticskyResult.sky_id", "==");
+    pxAddLabelSearchArgs(config, where, "-label", "staticskyRun.label", "==");
+    PXOPT_COPY_S16(config->args, where, "-fault", "staticskyResult.fault", "==");
 
     if (!psListLength(where->list) && !psMetadataLookupBool(NULL, config->args, "-all")) {
@@ -656,5 +680,5 @@
 
     // Delete product
-    psString delete = pxDataGet("staticskytool_revertsumskyfile_delete.sql");
+    psString delete = pxDataGet("staticskytool_revert.sql");
     if (!delete) {
         psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
@@ -680,39 +704,17 @@
 
     psFree(where);
-# endif
-
     return true;
 }
 
-# if (0)
-static bool updateresultState(pxConfig *config)
-{
-    // check that state is a valid string value
-    if (!pxIsValidState(state)) {
-        psError(PS_ERR_UNKNOWN, false, "invalid stackRun state: %s", state);
-        return false;
-    }
-
-    char *query = "UPDATE stackRun SET state = '%s' WHERE stack_id = %"PRId64;
-    if (!p_psDBRunQueryF(config->dbh, query, state, stack_id)) {
-        psError(PS_ERR_UNKNOWN, false,
-                "failed to change state for stack_id %"PRId64, stack_id);
-        return false;
-    }
-    return true;
-}
-# endif
-
 static bool updateresult(pxConfig *config)
 {
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-# if (0)
     PXOPT_LOOKUP_S16(fault, config->args, "-fault", true, false);
 
     psMetadata *where = psMetadataAlloc();
-    PXOPT_COPY_S64(config->args, where, "-stack_id",   "stack_id",   "==");
-
-    if (!pxSetFaultCode(config->dbh, "stackSumSkyfile", where, fault)) {
+    PXOPT_COPY_S64(config->args, where, "-sky_id",   "sky_id",   "==");
+
+    if (!pxSetFaultCode(config->dbh, "staticskyResult", where, fault)) {
         psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag");
         psFree (where);
@@ -720,6 +722,4 @@
     }
     psFree (where);
-
-# endif
     return true;
 }
@@ -898,4 +898,23 @@
 # endif
   return true;
+}
+
+static bool setstaticskyRunState(pxConfig *config, psS64 sky_id, const char *state)
+{
+    PS_ASSERT_PTR_NON_NULL(state, false);
+
+    // check that state is a valid string value
+    if (!pxIsValidState(state)) {
+        psError(PS_ERR_UNKNOWN, false, "invalid staticskyRun state: %s", state);
+        return false;
+    }
+
+    char *query = "UPDATE staticskyRun SET state = '%s' WHERE sky_id = %"PRId64;
+    if (!p_psDBRunQueryF(config->dbh, query, state, sky_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to change state for sky_id %"PRId64, sky_id);
+        return false;
+    }
+    return true;
+
 }
 
Index: trunk/ippTools/src/staticskytoolConfig.c
===================================================================
--- trunk/ippTools/src/staticskytoolConfig.c	(revision 28146)
+++ trunk/ippTools/src/staticskytoolConfig.c	(revision 28154)
@@ -61,4 +61,5 @@
     psMetadataAddTime(definebyqueryArgs, PS_LIST_TAIL, "-set_registered", 0, "time detrend run was registered", now);
     psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-pretend",  0, "do not actually modify the database", false);
+    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-check_inputs",  0, "list inputs, do not modify database", false);
     psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false);
 
