Index: trunk/dbconfig/config.md
===================================================================
--- trunk/dbconfig/config.md	(revision 11819)
+++ trunk/dbconfig/config.md	(revision 11820)
@@ -2,4 +2,4 @@
     pkg_name        STR     ippdb
     pkg_namespace   STR     ippdb
-    pkg_version     STR     1.1.7
+    pkg_version     STR     1.1.8
 END
Index: trunk/ippdb/Makefile.am
===================================================================
--- trunk/ippdb/Makefile.am	(revision 11819)
+++ trunk/ippdb/Makefile.am	(revision 11820)
@@ -47,8 +47,9 @@
     $(top_builddir)/docs/man/man3/p5RunRow.3 \
     $(top_builddir)/docs/man/man3/p5InputScfileRow.3 \
-    $(top_builddir)/docs/man/man3/p5DiffScfileRow.3 
+    $(top_builddir)/docs/man/man3/p5DiffScfileRow.3 \
+    $(top_builddir)/docs/man/man3/p6RunRow.3 
 
 
-docs/man/man3/ippdb.3 docs/man/man3/expTagCounterRow.3 docs/man/man3/summitExpRow.3 docs/man/man3/summitImfileRow.3 docs/man/man3/pzPendingExpRow.3 docs/man/man3/pzPendingImfileRow.3 docs/man/man3/pzDoneExpRow.3 docs/man/man3/pzDoneImfileRow.3 docs/man/man3/newExpRow.3 docs/man/man3/newImfileRow.3 docs/man/man3/rawExpRow.3 docs/man/man3/rawImfileRow.3 docs/man/man3/p1PendingExpRow.3 docs/man/man3/p2PendingExpRow.3 docs/man/man3/p2PendingImfileRow.3 docs/man/man3/p2ProcessedExpRow.3 docs/man/man3/p2MaskRow.3 docs/man/man3/p2ProcessedImfileRow.3 docs/man/man3/p3PendingExpRow.3 docs/man/man3/p3ProcessedExpRow.3 docs/man/man3/p3MaskRow.3 docs/man/man3/detRunRow.3 docs/man/man3/detInputExpRow.3 docs/man/man3/detProcessedImfileRow.3 docs/man/man3/detProcessedExpRow.3 docs/man/man3/detStackedImfileRow.3 docs/man/man3/detNormalizedStatImfileRow.3 docs/man/man3/detNormalizedImfileRow.3 docs/man/man3/detNormalizedExpRow.3 docs/man/man3/detResidImfileRow.3 docs/man/man3/detResidExpRow.3 docs/man/man3/detRunSummaryRow.3 docs/man/man3/p4RunRow.3 docs/man/man3/p4InputExpRow.3 docs/man/man3/p4SkyCellMapRow.3 docs/man/man3/p4ScfileRow.3 docs/man/man3/p5RunRow.3 docs/man/man3/p5InputScfileRow.3 docs/man/man3/p5DiffScfileRow.3:
+docs/man/man3/ippdb.3 docs/man/man3/expTagCounterRow.3 docs/man/man3/summitExpRow.3 docs/man/man3/summitImfileRow.3 docs/man/man3/pzPendingExpRow.3 docs/man/man3/pzPendingImfileRow.3 docs/man/man3/pzDoneExpRow.3 docs/man/man3/pzDoneImfileRow.3 docs/man/man3/newExpRow.3 docs/man/man3/newImfileRow.3 docs/man/man3/rawExpRow.3 docs/man/man3/rawImfileRow.3 docs/man/man3/p1PendingExpRow.3 docs/man/man3/p2PendingExpRow.3 docs/man/man3/p2PendingImfileRow.3 docs/man/man3/p2ProcessedExpRow.3 docs/man/man3/p2MaskRow.3 docs/man/man3/p2ProcessedImfileRow.3 docs/man/man3/p3PendingExpRow.3 docs/man/man3/p3ProcessedExpRow.3 docs/man/man3/p3MaskRow.3 docs/man/man3/detRunRow.3 docs/man/man3/detInputExpRow.3 docs/man/man3/detProcessedImfileRow.3 docs/man/man3/detProcessedExpRow.3 docs/man/man3/detStackedImfileRow.3 docs/man/man3/detNormalizedStatImfileRow.3 docs/man/man3/detNormalizedImfileRow.3 docs/man/man3/detNormalizedExpRow.3 docs/man/man3/detResidImfileRow.3 docs/man/man3/detResidExpRow.3 docs/man/man3/detRunSummaryRow.3 docs/man/man3/p4RunRow.3 docs/man/man3/p4InputExpRow.3 docs/man/man3/p4SkyCellMapRow.3 docs/man/man3/p4ScfileRow.3 docs/man/man3/p5RunRow.3 docs/man/man3/p5InputScfileRow.3 docs/man/man3/p5DiffScfileRow.3 docs/man/man3/p6RunRow.3:
 	$(DOXYGEN)
 
Index: trunk/ippdb/configure.ac
===================================================================
--- trunk/ippdb/configure.ac	(revision 11819)
+++ trunk/ippdb/configure.ac	(revision 11820)
@@ -7,5 +7,5 @@
 AC_PREREQ(2.59)
 
-AC_INIT([ippdb], [1.1.6], [pan-starrs.ifa.hawaii.edu])
+AC_INIT([ippdb], [1.1.8], [pan-starrs.ifa.hawaii.edu])
 AC_CONFIG_SRCDIR([ippdb.pc.in])
 
Index: trunk/ippdb/src/ippdb.c
===================================================================
--- trunk/ippdb/src/ippdb.c	(revision 11819)
+++ trunk/ippdb/src/ippdb.c	(revision 11820)
@@ -69,4 +69,5 @@
 #define P5INPUTSCFILE_TABLE_NAME "p5InputScfile"
 #define P5DIFFSCFILE_TABLE_NAME "p5DiffScfile"
+#define P6RUN_TABLE_NAME "p6Run"
 #define MAX_STRING_LENGTH 1024
 
@@ -3523,5 +3524,5 @@
 static void rawExpRowFree(rawExpRow *object);
 
-rawExpRow *rawExpRowAlloc(const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles, const char *workdir, const char *filter, psF32 airmass, psF64 ra, psF64 decl, psF32 exp_time, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF64 alt, psF64 az, psF32 ccd_temp, psF64 posang, const char *object, psS16 fault)
+rawExpRow *rawExpRowAlloc(const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles, const char *workdir, const char *filter, psF32 airmass, psF64 ra, psF64 decl, psF32 exp_time, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF64 alt, psF64 az, psF32 ccd_temp, psF64 posang, const char *object, psF32 solang, psS16 fault)
 {
     rawExpRow       *_object;
@@ -3551,4 +3552,5 @@
     _object->posang = posang;
     _object->object = psStringCopy(object);
+    _object->solang = solang;
     _object->fault = fault;
 
@@ -3677,4 +3679,9 @@
         return false;
     }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "solang", PS_DATA_F32, NULL, 0.0)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item solang");
+        psFree(md);
+        return false;
+    }
     if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "Key NOT NULL", 0)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
@@ -3695,5 +3702,5 @@
 }
 
-bool rawExpInsert(psDB * dbh, const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles, const char *workdir, const char *filter, psF32 airmass, psF64 ra, psF64 decl, psF32 exp_time, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF64 alt, psF64 az, psF32 ccd_temp, psF64 posang, const char *object, psS16 fault)
+bool rawExpInsert(psDB * dbh, const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles, const char *workdir, const char *filter, psF32 airmass, psF64 ra, psF64 decl, psF32 exp_time, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF64 alt, psF64 az, psF32 ccd_temp, psF64 posang, const char *object, psF32 solang, psS16 fault)
 {
     psMetadata *md = psMetadataAlloc();
@@ -3800,4 +3807,9 @@
     if (!psMetadataAdd(md, PS_LIST_TAIL, "object", PS_DATA_STRING, NULL, object)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item object");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "solang", PS_DATA_F32, NULL, solang)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item solang");
         psFree(md);
         return false;
@@ -3831,5 +3843,5 @@
 bool rawExpInsertObject(psDB *dbh, rawExpRow *object)
 {
-    return rawExpInsert(dbh, object->exp_tag, object->exp_id, object->camera, object->telescope, object->dateobs, object->exp_type, object->imfiles, object->workdir, object->filter, object->airmass, object->ra, object->decl, object->exp_time, object->bg, object->bg_stdev, object->bg_mean_stdev, object->alt, object->az, object->ccd_temp, object->posang, object->object, object->fault);
+    return rawExpInsert(dbh, object->exp_tag, object->exp_id, object->camera, object->telescope, object->dateobs, object->exp_type, object->imfiles, object->workdir, object->filter, object->airmass, object->ra, object->decl, object->exp_time, object->bg, object->bg_stdev, object->bg_mean_stdev, object->alt, object->az, object->ccd_temp, object->posang, object->object, object->solang, object->fault);
 }
 
@@ -4009,4 +4021,9 @@
         return false;
     }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "solang", PS_DATA_F32, NULL, object->solang)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item solang");
+        psFree(md);
+        return false;
+    }
     if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
@@ -4128,4 +4145,9 @@
         return false;
     }
+    psF32 solang = psMetadataLookupF32(&status, md, "solang");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item solang");
+        return false;
+    }
     psS16 fault = psMetadataLookupS16(&status, md, "fault");
     if (!status) {
@@ -4134,5 +4156,5 @@
     }
 
-    return rawExpRowAlloc(exp_tag, exp_id, camera, telescope, dateobs, exp_type, imfiles, workdir, filter, airmass, ra, decl, exp_time, bg, bg_stdev, bg_mean_stdev, alt, az, ccd_temp, posang, object, fault);
+    return rawExpRowAlloc(exp_tag, exp_id, camera, telescope, dateobs, exp_type, imfiles, workdir, filter, airmass, ra, decl, exp_time, bg, bg_stdev, bg_mean_stdev, alt, az, ccd_temp, posang, object, solang, fault);
 }
 psArray *rawExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
@@ -8334,5 +8356,5 @@
 static void detRunRowFree(detRunRow *object);
 
-detRunRow *detRunRowAlloc(psS32 det_id, psS32 iteration, const char *det_type, const char *mode, const char *state, const char *workdir, const char *camera, const char *telescope, const char *exp_type, const char *filter, psF32 airmass_min, psF32 airmass_max, psF32 exp_time_min, psF32 exp_time_max, psF32 ccd_temp_min, psF32 ccd_temp_max, psF64 posang_min, psF64 posang_max, psTime* registered, psTime* time_begin, psTime* time_end, psTime* use_begin, psTime* use_end)
+detRunRow *detRunRowAlloc(psS32 det_id, psS32 iteration, const char *det_type, const char *mode, const char *state, const char *workdir, const char *camera, const char *telescope, const char *exp_type, const char *filter, psF32 airmass_min, psF32 airmass_max, psF32 exp_time_min, psF32 exp_time_max, psF32 ccd_temp_min, psF32 ccd_temp_max, psF64 posang_min, psF64 posang_max, psTime* registered, psTime* time_begin, psTime* time_end, psTime* use_begin, psTime* use_end, psF32 solang_min, psF32 solang_max, const char *label, psS32 parent)
 {
     detRunRow       *_object;
@@ -8364,4 +8386,8 @@
     _object->use_begin = psTimeCopy(use_begin);
     _object->use_end = psTimeCopy(use_end);
+    _object->solang_min = solang_min;
+    _object->solang_max = solang_max;
+    _object->label = psStringCopy(label);
+    _object->parent = parent;
 
     return _object;
@@ -8383,4 +8409,5 @@
     psFree(object->use_begin);
     psFree(object->use_end);
+    psFree(object->label);
 }
 
@@ -8503,4 +8530,24 @@
         return false;
     }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "solang_min", PS_DATA_F32, NULL, 0.0)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item solang_min");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "solang_max", PS_DATA_F32, NULL, 0.0)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item solang_max");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, "key", "64")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item label");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "parent", PS_DATA_S32, "Key", 0)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item parent");
+        psFree(md);
+        return false;
+    }
 
     bool status = psDBCreateTable(dbh, DETRUN_TABLE_NAME, md);
@@ -8516,5 +8563,5 @@
 }
 
-bool detRunInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *det_type, const char *mode, const char *state, const char *workdir, const char *camera, const char *telescope, const char *exp_type, const char *filter, psF32 airmass_min, psF32 airmass_max, psF32 exp_time_min, psF32 exp_time_max, psF32 ccd_temp_min, psF32 ccd_temp_max, psF64 posang_min, psF64 posang_max, psTime* registered, psTime* time_begin, psTime* time_end, psTime* use_begin, psTime* use_end)
+bool detRunInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *det_type, const char *mode, const char *state, const char *workdir, const char *camera, const char *telescope, const char *exp_type, const char *filter, psF32 airmass_min, psF32 airmass_max, psF32 exp_time_min, psF32 exp_time_max, psF32 ccd_temp_min, psF32 ccd_temp_max, psF64 posang_min, psF64 posang_max, psTime* registered, psTime* time_begin, psTime* time_end, psTime* use_begin, psTime* use_end, psF32 solang_min, psF32 solang_max, const char *label, psS32 parent)
 {
     psMetadata *md = psMetadataAlloc();
@@ -8631,4 +8678,24 @@
     if (!psMetadataAdd(md, PS_LIST_TAIL, "use_end", PS_DATA_TIME, NULL, use_end)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item use_end");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "solang_min", PS_DATA_F32, NULL, solang_min)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item solang_min");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "solang_max", PS_DATA_F32, NULL, solang_max)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item solang_max");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, NULL, label)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item label");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "parent", PS_DATA_S32, NULL, parent)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item parent");
         psFree(md);
         return false;
@@ -8657,5 +8724,5 @@
 bool detRunInsertObject(psDB *dbh, detRunRow *object)
 {
-    return detRunInsert(dbh, object->det_id, object->iteration, object->det_type, object->mode, object->state, object->workdir, object->camera, object->telescope, object->exp_type, object->filter, object->airmass_min, object->airmass_max, object->exp_time_min, object->exp_time_max, object->ccd_temp_min, object->ccd_temp_max, object->posang_min, object->posang_max, object->registered, object->time_begin, object->time_end, object->use_begin, object->use_end);
+    return detRunInsert(dbh, object->det_id, object->iteration, object->det_type, object->mode, object->state, object->workdir, object->camera, object->telescope, object->exp_type, object->filter, object->airmass_min, object->airmass_max, object->exp_time_min, object->exp_time_max, object->ccd_temp_min, object->ccd_temp_max, object->posang_min, object->posang_max, object->registered, object->time_begin, object->time_end, object->use_begin, object->use_end, object->solang_min, object->solang_max, object->label, object->parent);
 }
 
@@ -8845,4 +8912,24 @@
         return false;
     }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "solang_min", PS_DATA_F32, NULL, object->solang_min)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item solang_min");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "solang_max", PS_DATA_F32, NULL, object->solang_max)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item solang_max");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, NULL, object->label)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item label");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "parent", PS_DATA_S32, NULL, object->parent)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item parent");
+        psFree(md);
+        return false;
+    }
 
 
@@ -8969,6 +9056,26 @@
         return false;
     }
-
-    return detRunRowAlloc(det_id, iteration, det_type, mode, state, workdir, camera, telescope, exp_type, filter, airmass_min, airmass_max, exp_time_min, exp_time_max, ccd_temp_min, ccd_temp_max, posang_min, posang_max, registered, time_begin, time_end, use_begin, use_end);
+    psF32 solang_min = psMetadataLookupF32(&status, md, "solang_min");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item solang_min");
+        return false;
+    }
+    psF32 solang_max = psMetadataLookupF32(&status, md, "solang_max");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item solang_max");
+        return false;
+    }
+    char* label = psMetadataLookupPtr(&status, md, "label");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item label");
+        return false;
+    }
+    psS32 parent = psMetadataLookupS32(&status, md, "parent");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item parent");
+        return false;
+    }
+
+    return detRunRowAlloc(det_id, iteration, det_type, mode, state, workdir, camera, telescope, exp_type, filter, airmass_min, airmass_max, exp_time_min, exp_time_max, ccd_temp_min, ccd_temp_max, posang_min, posang_max, registered, time_begin, time_end, use_begin, use_end, solang_min, solang_max, label, parent);
 }
 psArray *detRunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
@@ -13855,10 +13962,10 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, "Primary Key", 0)) {
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, "Key", 0)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");
         psFree(md);
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "magiced", PS_DATA_BOOL, "Primary Key", 0)) {
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "magiced", PS_DATA_BOOL, "Key", 0)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item magiced");
         psFree(md);
@@ -14586,10 +14693,10 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_tag", PS_DATA_STRING, "Primary Key", "64")) {
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_tag", PS_DATA_STRING, "Key", "64")) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
         psFree(md);
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, "Primary Key", 0)) {
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, "Key", 0)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");
         psFree(md);
@@ -15304,5 +15411,5 @@
 static void p5InputScfileRowFree(p5InputScfileRow *object);
 
-p5InputScfileRow *p5InputScfileRowAlloc(psS32 p5_id, psS32 p4_id, const char *skycell_id, const char *tess_id, const char *exp_tag, psS32 p3_version, const char *kind, bool template)
+p5InputScfileRow *p5InputScfileRowAlloc(psS32 p5_id, psS32 p4_id, const char *skycell_id, const char *tess_id, const char *kind, bool template)
 {
     p5InputScfileRow *_object;
@@ -15315,6 +15422,4 @@
     _object->skycell_id = psStringCopy(skycell_id);
     _object->tess_id = psStringCopy(tess_id);
-    _object->exp_tag = psStringCopy(exp_tag);
-    _object->p3_version = p3_version;
     _object->kind = psStringCopy(kind);
     _object->template = template;
@@ -15327,5 +15432,4 @@
     psFree(object->skycell_id);
     psFree(object->tess_id);
-    psFree(object->exp_tag);
     psFree(object->kind);
 }
@@ -15354,14 +15458,4 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_tag", PS_DATA_STRING, "Primary Key", "64")) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
-        psFree(md);
-        return false;
-    }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, "Primary Key", 0)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");
-        psFree(md);
-        return false;
-    }
     if (!psMetadataAdd(md, PS_LIST_TAIL, "kind", PS_DATA_STRING, "Key", "64")) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item kind");
@@ -15387,5 +15481,5 @@
 }
 
-bool p5InputScfileInsert(psDB * dbh, psS32 p5_id, psS32 p4_id, const char *skycell_id, const char *tess_id, const char *exp_tag, psS32 p3_version, const char *kind, bool template)
+bool p5InputScfileInsert(psDB * dbh, psS32 p5_id, psS32 p4_id, const char *skycell_id, const char *tess_id, const char *kind, bool template)
 {
     psMetadata *md = psMetadataAlloc();
@@ -15407,14 +15501,4 @@
     if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, NULL, tess_id)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id");
-        psFree(md);
-        return false;
-    }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_tag", PS_DATA_STRING, NULL, exp_tag)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
-        psFree(md);
-        return false;
-    }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, NULL, p3_version)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");
         psFree(md);
         return false;
@@ -15453,5 +15537,5 @@
 bool p5InputScfileInsertObject(psDB *dbh, p5InputScfileRow *object)
 {
-    return p5InputScfileInsert(dbh, object->p5_id, object->p4_id, object->skycell_id, object->tess_id, object->exp_tag, object->p3_version, object->kind, object->template);
+    return p5InputScfileInsert(dbh, object->p5_id, object->p4_id, object->skycell_id, object->tess_id, object->kind, object->template);
 }
 
@@ -15546,14 +15630,4 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_tag", PS_DATA_STRING, NULL, object->exp_tag)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
-        psFree(md);
-        return false;
-    }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, NULL, object->p3_version)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");
-        psFree(md);
-        return false;
-    }
     if (!psMetadataAdd(md, PS_LIST_TAIL, "kind", PS_DATA_STRING, NULL, object->kind)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item kind");
@@ -15595,14 +15669,4 @@
         return false;
     }
-    char* exp_tag = psMetadataLookupPtr(&status, md, "exp_tag");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_tag");
-        return false;
-    }
-    psS32 p3_version = psMetadataLookupS32(&status, md, "p3_version");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p3_version");
-        return false;
-    }
     char* kind = psMetadataLookupPtr(&status, md, "kind");
     if (!status) {
@@ -15616,5 +15680,5 @@
     }
 
-    return p5InputScfileRowAlloc(p5_id, p4_id, skycell_id, tess_id, exp_tag, p3_version, kind, template);
+    return p5InputScfileRowAlloc(p5_id, p4_id, skycell_id, tess_id, kind, template);
 }
 psArray *p5InputScfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
@@ -16107,2 +16171,341 @@
     return true;
 }
+static void p6RunRowFree(p6RunRow *object);
+
+p6RunRow *p6RunRowAlloc(psS32 p6_id, const char *state, const char *workdir, psTime* registered)
+{
+    p6RunRow        *_object;
+
+    _object = psAlloc(sizeof(p6RunRow));
+    psMemSetDeallocator(_object, (psFreeFunc)p6RunRowFree);
+
+    _object->p6_id = p6_id;
+    _object->state = psStringCopy(state);
+    _object->workdir = psStringCopy(workdir);
+    _object->registered = psTimeCopy(registered);
+
+    return _object;
+}
+
+static void p6RunRowFree(p6RunRow *object)
+{
+    psFree(object->state);
+    psFree(object->workdir);
+    psFree(object->registered);
+}
+
+bool p6RunCreateTable(psDB *dbh)
+{
+    psMetadata *md = psMetadataAlloc();
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "p6_id", PS_DATA_S32, "Primary Key AUTO_INCREMENT", 0)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item p6_id");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, "Key", "64")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item state");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "workdir", PS_DATA_STRING, NULL, "255")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item workdir");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "registered", PS_DATA_TIME, NULL, NULL)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item registered");
+        psFree(md);
+        return false;
+    }
+
+    bool status = psDBCreateTable(dbh, P6RUN_TABLE_NAME, md);
+
+    psFree(md);
+
+    return status;
+}
+
+bool p6RunDropTable(psDB *dbh)
+{
+    return psDBDropTable(dbh, P6RUN_TABLE_NAME);
+}
+
+bool p6RunInsert(psDB * dbh, psS32 p6_id, const char *state, const char *workdir, psTime* registered)
+{
+    psMetadata *md = psMetadataAlloc();
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "p6_id", PS_DATA_S32, NULL, p6_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item p6_id");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, state)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item state");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "workdir", PS_DATA_STRING, NULL, workdir)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item workdir");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "registered", PS_DATA_TIME, NULL, registered)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item registered");
+        psFree(md);
+        return false;
+    }
+
+    bool status = psDBInsertOneRow(dbh, P6RUN_TABLE_NAME, md);
+    psFree(md);
+
+    return status;
+}
+
+long long p6RunDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)
+{
+    long long       deleted = 0;
+
+    long long count = psDBDeleteRows(dbh, P6RUN_TABLE_NAME, where, limit);
+    if (count < 0) {
+        psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6Run");
+        return count;
+
+        deleted += count;
+    }
+
+    return deleted;
+}
+bool p6RunInsertObject(psDB *dbh, p6RunRow *object)
+{
+    return p6RunInsert(dbh, object->p6_id, object->state, object->workdir, object->registered);
+}
+
+bool p6RunInsertObjects(psDB *dbh, psArray *objects)
+{
+    for (long i = 0; i < psArrayLength(objects); i++) {
+        if (!p6RunInsertObject(dbh, objects->data[i])) {
+            return false;
+        }
+    }
+
+    return true;
+}
+
+bool p6RunInsertFits(psDB *dbh, const psFits *fits)
+{
+    psArray         *rowSet;
+
+    // move to (the first?) extension named  P6RUN_TABLE_NAME
+    if (!psFitsMoveExtName(fits, P6RUN_TABLE_NAME)) {
+        psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P6RUN_TABLE_NAME);
+        return false;
+    }
+
+    // check HDU type
+    if (psFitsGetExtType(fits) != PS_FITS_TYPE_BINARY_TABLE)  {
+        psError(PS_ERR_UNKNOWN, true, "FITS HDU type is not PS_FITS_TYPE_BINARY_TABLE");
+        return false;
+    }
+
+    // read fits table
+    rowSet = psFitsReadTable(fits);
+    if (!rowSet) {
+        psError(PS_ERR_UNKNOWN, true, "FITS read error or FITS table is empty");
+        psFree(rowSet);
+        return false;
+    }
+
+    if (!psDBInsertRows(dbh, P6RUN_TABLE_NAME, rowSet)) {
+        psError(PS_ERR_UNKNOWN, false, "databse insert failed");
+        psFree(rowSet);
+        return false;
+    }
+
+    psFree(rowSet);
+
+    return true;
+}
+
+bool p6RunSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)
+{
+    psArray         *rowSet;
+
+    rowSet = psDBSelectRows(dbh, P6RUN_TABLE_NAME, where, limit);
+    if (!rowSet) {
+        return false;
+    }
+
+    // output to fits
+    if (!psFitsWriteTable(fits, NULL, rowSet, P6RUN_TABLE_NAME)) {
+        psError(PS_ERR_UNKNOWN, false, "FITS table write failed");
+        psFree(rowSet);
+        return false;
+    }
+
+    psFree(rowSet);
+
+    return true;
+}
+
+psMetadata *p6RunMetadataFromObject(const p6RunRow *object)
+{
+    psMetadata *md = psMetadataAlloc();
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "p6_id", PS_DATA_S32, NULL, object->p6_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item p6_id");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, object->state)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item state");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "workdir", PS_DATA_STRING, NULL, object->workdir)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item workdir");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "registered", PS_DATA_TIME, NULL, object->registered)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item registered");
+        psFree(md);
+        return false;
+    }
+
+
+    return md;
+}
+
+p6RunRow *p6RunObjectFromMetadata(psMetadata *md)
+{
+
+bool status = false;
+    psS32 p6_id = psMetadataLookupS32(&status, md, "p6_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p6_id");
+        return false;
+    }
+    char* state = psMetadataLookupPtr(&status, md, "state");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item state");
+        return false;
+    }
+    char* workdir = psMetadataLookupPtr(&status, md, "workdir");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item workdir");
+        return false;
+    }
+    psTime* registered = psMetadataLookupPtr(&status, md, "registered");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item registered");
+        return false;
+    }
+
+    return p6RunRowAlloc(p6_id, state, workdir, registered);
+}
+psArray *p6RunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
+{
+    psArray         *rowSet;
+    psArray         *returnSet;
+    psU64           i;
+
+    rowSet = psDBSelectRows(dbh, P6RUN_TABLE_NAME, where, limit);
+    if (!rowSet) {
+        return NULL;
+    }
+
+    // convert psMetadata rows to row objects
+
+    returnSet = psArrayAllocEmpty(rowSet->n);
+
+    for (i = 0; i < rowSet->n; i++) {
+        p6RunRow *object = p6RunObjectFromMetadata(rowSet->data[i]);
+        psArrayAdd(returnSet, 0, object);
+        psFree(object);
+    }
+
+    psFree(rowSet);
+
+    return returnSet;
+}
+bool p6RunDeleteObject(psDB *dbh, const p6RunRow *object)
+{
+    psMetadata *where = p6RunMetadataFromObject(object);
+    long long count = psDBDeleteRows(dbh, P6RUN_TABLE_NAME, where, 0);
+    psFree(where);
+    if (count < 0) {
+        psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6Run");
+        return false;
+    }
+    if (count > 1) {
+        // XXX should this be a psAbort() instead?  It is possible that
+        // having an object match multiple rows was by design.
+        psError(PS_ERR_UNKNOWN, true, "p6RunRow object matched more then one row.  Check your database schema");
+        return false;
+    }
+
+    return true;
+}
+long long p6RunDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)
+{
+    long long       deleted = 0;
+
+    for (long long i = 0; i < objects->n; i++) {
+        p6RunRow *object = objects->data[i];
+        psMetadata *where = p6RunMetadataFromObject(object);
+        long long count = psDBDeleteRows(dbh, P6RUN_TABLE_NAME, where, limit);
+        psFree(where);
+        if (count < 0) {
+            psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6Run");
+            return count;
+        }
+
+        deleted += count;
+    }
+
+    return deleted;
+}
+bool p6RunPrintObjects(FILE *stream, psArray *objects, bool mdcf)
+{
+    PS_ASSERT_PTR_NON_NULL(objects, false);
+
+    psMetadata *output = psMetadataAlloc();
+    for (long i = 0; i < psArrayLength(objects); i++) {
+        psMetadata *md = p6RunMetadataFromObject(objects->data[i]);
+        if (!psMetadataAddMetadata(
+            output,
+            PS_LIST_TAIL,
+            P6RUN_TABLE_NAME,
+            PS_META_DUPLICATE_OK,
+            NULL,
+            md
+        )) {
+            psError(PS_ERR_UNKNOWN, false, "failed to add metadata");
+            psFree(md);
+            psFree(output);
+            return false;
+        }
+        psFree(md);
+    }
+
+    if (!ippdbPrintMetadataRaw(stream, output, mdcf)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to print metadata");
+        psFree(output);
+    }
+    psFree(output);
+
+    return true;
+}
+bool p6RunPrintObject(FILE *stream, p6RunRow *object, bool mdcf)
+{
+    PS_ASSERT_PTR_NON_NULL(object, false);
+
+    psMetadata *md = p6RunMetadataFromObject(object);
+
+    if (!ippdbPrintMetadataRaw(stream, md, mdcf)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to print metadata");
+        psFree(md);
+    }
+
+    psFree(md);
+
+    return true;
+}
Index: trunk/ippdb/src/ippdb.h
===================================================================
--- trunk/ippdb/src/ippdb.h	(revision 11819)
+++ trunk/ippdb/src/ippdb.h	(revision 11820)
@@ -2018,4 +2018,5 @@
     psF64           posang;
     char            *object;
+    psF32           solang;
     psS16           fault;
 } rawExpRow;
@@ -2048,4 +2049,5 @@
     psF64           posang,
     const char      *object,
+    psF32           solang,
     psS16           fault
 );
@@ -2099,4 +2101,5 @@
     psF64           posang,
     const char      *object,
+    psF32           solang,
     psS16           fault
 );
@@ -4417,4 +4420,8 @@
     psTime*         use_begin;
     psTime*         use_end;
+    psF32           solang_min;
+    psF32           solang_max;
+    char            *label;
+    psS32           parent;
 } detRunRow;
 
@@ -4447,5 +4454,9 @@
     psTime*         time_end,
     psTime*         use_begin,
-    psTime*         use_end
+    psTime*         use_end,
+    psF32           solang_min,
+    psF32           solang_max,
+    const char      *label,
+    psS32           parent
 );
 
@@ -4499,5 +4510,9 @@
     psTime*         time_end,
     psTime*         use_begin,
-    psTime*         use_end
+    psTime*         use_end,
+    psF32           solang_min,
+    psF32           solang_max,
+    const char      *label,
+    psS32           parent
 );
 
@@ -7881,6 +7896,4 @@
     char            *skycell_id;
     char            *tess_id;
-    char            *exp_tag;
-    psS32           p3_version;
     char            *kind;
     bool            template;
@@ -7897,6 +7910,4 @@
     const char      *skycell_id,
     const char      *tess_id,
-    const char      *exp_tag,
-    psS32           p3_version,
     const char      *kind,
     bool            template
@@ -7934,6 +7945,4 @@
     const char      *skycell_id,
     const char      *tess_id,
-    const char      *exp_tag,
-    psS32           p3_version,
     const char      *kind,
     bool            template
@@ -8297,4 +8306,208 @@
     bool            mdcf                ///< format as mdconfig or simple
 );
+/** p6RunRow data structure
+ *
+ * Structure for representing a single row of p6Run table data.
+ */
+
+typedef struct {
+    psS32           p6_id;
+    char            *state;
+    char            *workdir;
+    psTime*         registered;
+} p6RunRow;
+
+/** Creates a new p6RunRow object
+ *
+ *  @return A new p6RunRow object or NULL on failure.
+ */
+
+p6RunRow *p6RunRowAlloc(
+    psS32           p6_id,
+    const char      *state,
+    const char      *workdir,
+    psTime*         registered
+);
+
+/** Creates a new p6Run table
+ *
+ * @return true on success
+ */
+
+bool p6RunCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a p6Run table
+ *
+ * @return true on success
+ */
+
+bool p6RunDropTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Insert a single row into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool p6RunInsert(
+    psDB            *dbh,               ///< Database handle
+    psS32           p6_id,
+    const char      *state,
+    const char      *workdir,
+    psTime*         registered
+);
+
+/** Deletes up to limit rows from the database and returns the number of rows actually deleted. 
+ *
+ * @return A The number of rows removed or a negative value on error
+ */
+
+long long p6RunDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single p6RunRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool p6RunInsertObject(
+    psDB            *dbh,               ///< Database handle
+    p6RunRow        *object             ///< p6RunRow object
+);
+
+/** Insert an array of p6RunRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool p6RunInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of p6RunRow objects
+);
+
+/** Insert data from a binary FITS table p6RunRow into the database
+ *
+ * This function expects a psFits object with a FITS table as the first
+ * extension.  The table must have at least one row of data in it, that is of
+ * the appropriate format (number of columns and their type).  All other
+ * extensions are ignored.
+ *
+ * @return true on success
+ */
+
+bool p6RunInsertFits(
+    psDB            *dbh,               ///< Database handle
+    const psFits    *fits               ///< psFits object
+);
+
+/** Selects up to limit from the database and returns them in a binary FITS table
+ *
+ * This function assumes an empty psFits object and will create a FITS table
+ * as the first extension.
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return true on success
+ */
+
+bool p6RunSelectRowsFits(
+    psDB            *dbh,               ///< Database handle
+    psFits          *fits,              ///< psFits object
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to return
+);
+
+/** Convert a p6RunRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *p6RunMetadataFromObject(
+    const p6RunRow  *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A p6RunRow pointer or NULL on error
+ */
+
+p6RunRow *p6RunObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as p6RunRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *p6RunSelectRowObjects(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to return
+);
+/** Deletes a row from the database coresponding to an p6Run
+ *
+ *  Note that a 'where' search psMetadata is constructed from each object and
+ *  used to find rows to delete.
+ *
+ * @return A The number of rows removed or a negative value on error
+ */
+
+bool p6RunDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const p6RunRow *object    ///< Object to delete
+);
+/** Deletes up to limit rows from the database and returns the number of rows actually deleted. 
+ *
+ *  Note that a 'where' search psMetadata is constructed from each object and
+ *  used to find rows to delete.
+ *
+ * @return A The number of rows removed or a negative value on error
+ */
+
+long long p6RunDeleteRowObjects(
+    psDB            *dbh,               ///< Database handle
+    const psArray   *objects,           ///< Array of objects to delete
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+/** Formats and prints an array of p6RunRow objects
+ *
+ * When mdcf is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
+ */
+
+bool p6RunPrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of p6RunRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** Formats and prints an p6RunRow object
+ *
+ * When mdcf is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
+ */
+
+bool p6RunPrintObject(
+    FILE            *stream,            ///< a stream
+    p6RunRow *object,    ///< an p6RunRow object
+    bool            mdcf                ///< format as mdconfig or simple
+);
 
 /// @}
@@ -8304,3 +8517,3 @@
 #endif
 
-#endif // P5DIFFSCFILE_DB_H
+#endif // P6RUN_DB_H
Index: trunk/ippdb/tests/alloc.c
===================================================================
--- trunk/ippdb/tests/alloc.c	(revision 11819)
+++ trunk/ippdb/tests/alloc.c	(revision 11820)
@@ -311,5 +311,5 @@
         rawExpRow       *object;
 
-        object = rawExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", -16    );
+        object = rawExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", 32.32, -16    );
 
         if (!object) {
@@ -400,4 +400,8 @@
             exit(EXIT_FAILURE);
         }
+        if (!object->solang == 32.32) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
         if (!object->fault == -16) {
             psFree(object);
@@ -832,5 +836,5 @@
         detRunRow       *object;
 
-        object = detRunRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z"    );
+        object = detRunRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", 32.32, 32.32, "a string", -32    );
 
         if (!object) {
@@ -925,4 +929,20 @@
             exit(EXIT_FAILURE);
         }
+        if (!object->solang_min == 32.32) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (!object->solang_max == 32.32) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (!object->parent == -32) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
 
         psFree(object);
@@ -1581,5 +1601,5 @@
         p5InputScfileRow *object;
 
-        object = p5InputScfileRowAlloc(-32, -32, "a string", "a string", "a string", -32, "a string", true    );
+        object = p5InputScfileRowAlloc(-32, -32, "a string", "a string", "a string", true    );
 
         if (!object) {
@@ -1603,12 +1623,4 @@
             exit(EXIT_FAILURE);
         }
-        if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) {
-            psFree(object);
-            exit(EXIT_FAILURE);
-        }
-        if (!object->p3_version == -32) {
-            psFree(object);
-            exit(EXIT_FAILURE);
-        }
         if (strncmp(object->kind, "a string", MAX_STRING_LENGTH)) {
             psFree(object);
@@ -1653,4 +1665,32 @@
         }
         if (!object->bg_mean_stdev == 64.64) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(object);
+    }
+
+    {
+        p6RunRow        *object;
+
+        object = p6RunRowAlloc(-32, "a string", "a string", "0001-01-01T00:00:00Z"    );
+
+        if (!object) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!object->p6_id == -32) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->workdir, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
             psFree(object);
             exit(EXIT_FAILURE);
Index: trunk/ippdb/tests/createtable.c
===================================================================
--- trunk/ippdb/tests/createtable.c	(revision 11819)
+++ trunk/ippdb/tests/createtable.c	(revision 11820)
@@ -575,4 +575,19 @@
     }
 
+    {
+        psDB            *dbh;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if(!p6RunCreateTable(dbh)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
     exit(EXIT_SUCCESS);
 }
Index: trunk/ippdb/tests/dbcleanup.c
===================================================================
--- trunk/ippdb/tests/dbcleanup.c	(revision 11819)
+++ trunk/ippdb/tests/dbcleanup.c	(revision 11820)
@@ -49,4 +49,5 @@
     p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5InputScfile");
     p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5DiffScfile");
+    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6Run");
 
     psDBCleanup(dbh);
Index: trunk/ippdb/tests/dbsetup.c
===================================================================
--- trunk/ippdb/tests/dbsetup.c	(revision 11819)
+++ trunk/ippdb/tests/dbsetup.c	(revision 11820)
@@ -127,4 +127,7 @@
     p5DiffScfileCreateTable(dbh);
 
+    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6Run");
+    p6RunCreateTable(dbh);
+
     psDBCleanup(dbh);
 
Index: trunk/ippdb/tests/droptable.c
===================================================================
--- trunk/ippdb/tests/droptable.c	(revision 11819)
+++ trunk/ippdb/tests/droptable.c	(revision 11820)
@@ -575,4 +575,19 @@
     }
 
+    {
+        psDB            *dbh;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!p6RunDropTable(dbh)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
     exit(EXIT_SUCCESS);
 }
Index: trunk/ippdb/tests/insert.c
===================================================================
--- trunk/ippdb/tests/insert.c	(revision 11819)
+++ trunk/ippdb/tests/insert.c	(revision 11820)
@@ -148,5 +148,5 @@
         }
 
-        if (!rawExpInsert(dbh, "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", -16)) {
+        if (!rawExpInsert(dbh, "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", 32.32, -16)) {
             exit(EXIT_FAILURE);
         }
@@ -313,5 +313,5 @@
         }
 
-        if (!detRunInsert(dbh, -32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z")) {
+        if (!detRunInsert(dbh, -32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", 32.32, 32.32, "a string", -32)) {
             exit(EXIT_FAILURE);
         }
@@ -553,5 +553,5 @@
         }
 
-        if (!p5InputScfileInsert(dbh, -32, -32, "a string", "a string", "a string", -32, "a string", true)) {
+        if (!p5InputScfileInsert(dbh, -32, -32, "a string", "a string", "a string", true)) {
             exit(EXIT_FAILURE);
         }
@@ -569,4 +569,19 @@
 
         if (!p5DiffScfileInsert(dbh, -32, "a string", "a string", "a string", 64.64, 64.64)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!p6RunInsert(dbh, -32, "a string", "a string", "0001-01-01T00:00:00Z")) {
             exit(EXIT_FAILURE);
         }
Index: trunk/ippdb/tests/insertfits.c
===================================================================
--- trunk/ippdb/tests/insertfits.c	(revision 11819)
+++ trunk/ippdb/tests/insertfits.c	(revision 11820)
@@ -997,4 +997,30 @@
     }
 
+    {
+        psDB            *dbh;
+        psFits          *fits;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        // open a temp
+        fits = psFitsOpen(TMP_FILENAME, "r");
+        if (!fits) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!p6RunInsertFits(dbh, fits)) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!psFitsClose(fits)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
     exit(EXIT_SUCCESS);
 }
Index: trunk/ippdb/tests/insertobject.c
===================================================================
--- trunk/ippdb/tests/insertobject.c	(revision 11819)
+++ trunk/ippdb/tests/insertobject.c	(revision 11820)
@@ -212,5 +212,5 @@
         }
 
-        object = rawExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", -16);
+        object = rawExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", 32.32, -16);
         if (!object) {
             exit(EXIT_FAILURE);
@@ -454,5 +454,5 @@
         }
 
-        object = detRunRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z");
+        object = detRunRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", 32.32, 32.32, "a string", -32);
         if (!object) {
             exit(EXIT_FAILURE);
@@ -806,5 +806,5 @@
         }
 
-        object = p5InputScfileRowAlloc(-32, -32, "a string", "a string", "a string", -32, "a string", true);
+        object = p5InputScfileRowAlloc(-32, -32, "a string", "a string", "a string", true);
         if (!object) {
             exit(EXIT_FAILURE);
@@ -834,4 +834,26 @@
 
         if (!p5DiffScfileInsertObject(dbh, object)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(object);
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+        p6RunRow        *object;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        object = p6RunRowAlloc(-32, "a string", "a string", "0001-01-01T00:00:00Z");
+        if (!object) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!p6RunInsertObject(dbh, object)) {
             exit(EXIT_FAILURE);
         }
Index: trunk/ippdb/tests/metadatafromobject.c
===================================================================
--- trunk/ippdb/tests/metadatafromobject.c	(revision 11819)
+++ trunk/ippdb/tests/metadatafromobject.c	(revision 11820)
@@ -384,5 +384,5 @@
         bool            status;
 
-        object = rawExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", -16);
+        object = rawExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", 32.32, -16);
         if (!object) {
             exit(EXIT_FAILURE);
@@ -479,4 +479,8 @@
             exit(EXIT_FAILURE);
         }
+        if (!psMetadataLookupF32(&status, md, "solang") == 32.32) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
             psFree(md);
             exit(EXIT_FAILURE);
@@ -989,5 +993,5 @@
         bool            status;
 
-        object = detRunRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z");
+        object = detRunRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", 32.32, 32.32, "a string", -32);
         if (!object) {
             exit(EXIT_FAILURE);
@@ -1088,4 +1092,20 @@
             exit(EXIT_FAILURE);
         }
+        if (!psMetadataLookupF32(&status, md, "solang_min") == 32.32) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataLookupF32(&status, md, "solang_max") == 32.32) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(psMetadataLookupPtr(&status, md, "label"), "a string", MAX_STRING_LENGTH)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataLookupS32(&status, md, "parent") == -32) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
 
         psFree(md);
@@ -1857,5 +1877,5 @@
         bool            status;
 
-        object = p5InputScfileRowAlloc(-32, -32, "a string", "a string", "a string", -32, "a string", true);
+        object = p5InputScfileRowAlloc(-32, -32, "a string", "a string", "a string", true);
         if (!object) {
             exit(EXIT_FAILURE);
@@ -1885,12 +1905,4 @@
             exit(EXIT_FAILURE);
         }
-        if (strncmp(psMetadataLookupPtr(&status, md, "exp_tag"), "a string", MAX_STRING_LENGTH)) {
-            psFree(md);
-            exit(EXIT_FAILURE);
-        }
-        if (!psMetadataLookupS32(&status, md, "p3_version") == -32) {
-            psFree(md);
-            exit(EXIT_FAILURE);
-        }
         if (strncmp(psMetadataLookupPtr(&status, md, "kind"), "a string", MAX_STRING_LENGTH)) {
             psFree(md);
@@ -1943,4 +1955,40 @@
         }
         if (!psMetadataLookupF64(&status, md, "bg_mean_stdev") == 64.64) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(md);
+    }
+
+    {
+        psMetadata      *md;
+        p6RunRow        *object;
+        bool            status;
+
+        object = p6RunRowAlloc(-32, "a string", "a string", "0001-01-01T00:00:00Z");
+        if (!object) {
+            exit(EXIT_FAILURE);
+        }
+
+        md = p6RunMetadataFromObject(object);
+        if (!md) {
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(object);
+
+        if (!psMetadataLookupS32(&status, md, "p6_id") == -32) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(psMetadataLookupPtr(&status, md, "state"), "a string", MAX_STRING_LENGTH)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(psMetadataLookupPtr(&status, md, "workdir"), "a string", MAX_STRING_LENGTH)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
             psFree(md);
             exit(EXIT_FAILURE);
Index: trunk/ippdb/tests/objectfrommetadata.c
===================================================================
--- trunk/ippdb/tests/objectfrommetadata.c	(revision 11819)
+++ trunk/ippdb/tests/objectfrommetadata.c	(revision 11820)
@@ -622,4 +622,8 @@
             exit(EXIT_FAILURE);
         }
+        if (!psMetadataAddF32(md, PS_LIST_TAIL, "solang", 0, NULL, 32.32)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
             psFree(md);
             exit(EXIT_FAILURE);
@@ -717,4 +721,8 @@
             exit(EXIT_FAILURE);
         }
+        if (!object->solang == 32.32) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
             psFree(object);
             exit(EXIT_FAILURE);
@@ -1572,4 +1580,20 @@
             exit(EXIT_FAILURE);
         }
+        if (!psMetadataAddF32(md, PS_LIST_TAIL, "solang_min", 0, NULL, 32.32)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataAddF32(md, PS_LIST_TAIL, "solang_max", 0, NULL, 32.32)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "label", 0, NULL, "a string")) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataAddS32(md, PS_LIST_TAIL, "parent", 0, NULL, -32)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
 
         object = detRunObjectFromMetadata(md);
@@ -1668,4 +1692,20 @@
             exit(EXIT_FAILURE);
         }
+        if (!object->solang_min == 32.32) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (!object->solang_max == 32.32) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (!object->parent == -32) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
 
         psFree(object);
@@ -2853,12 +2893,4 @@
             exit(EXIT_FAILURE);
         }
-        if (!psMetadataAddStr(md, PS_LIST_TAIL, "exp_tag", 0, NULL, "a string")) {
-            psFree(md);
-            exit(EXIT_FAILURE);
-        }
-        if (!psMetadataAddS32(md, PS_LIST_TAIL, "p3_version", 0, NULL, -32)) {
-            psFree(md);
-            exit(EXIT_FAILURE);
-        }
         if (!psMetadataAddStr(md, PS_LIST_TAIL, "kind", 0, NULL, "a string")) {
             psFree(md);
@@ -2894,12 +2926,4 @@
             exit(EXIT_FAILURE);
         }
-        if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) {
-            psFree(object);
-            exit(EXIT_FAILURE);
-        }
-        if (!object->p3_version == -32) {
-            psFree(object);
-            exit(EXIT_FAILURE);
-        }
         if (strncmp(object->kind, "a string", MAX_STRING_LENGTH)) {
             psFree(object);
@@ -2973,4 +2997,52 @@
         }
         if (!object->bg_mean_stdev == 64.64) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(object);
+    }
+
+    {
+        psMetadata      *md;
+        p6RunRow        *object;
+
+        md = psMetadataAlloc();
+        if (!psMetadataAddS32(md, PS_LIST_TAIL, "p6_id", 0, NULL, -32)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "state", 0, NULL, "a string")) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "workdir", 0, NULL, "a string")) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+
+        object = p6RunObjectFromMetadata(md);
+        if (!object) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(md);
+
+        if (!object->p6_id == -32) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->workdir, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
             psFree(object);
             exit(EXIT_FAILURE);
Index: trunk/ippdb/tests/selectrowsfits.c
===================================================================
--- trunk/ippdb/tests/selectrowsfits.c	(revision 11819)
+++ trunk/ippdb/tests/selectrowsfits.c	(revision 11820)
@@ -843,4 +843,26 @@
     }
 
+    {
+        psDB            *dbh;
+        psFits          *fits;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        fits = psFitsOpen(TMP_FILENAME, "w");
+        if (!fits) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!p6RunSelectRowsFits(dbh, fits, NULL, 1)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(fits);
+        psDBCleanup(dbh);
+    }
+
     exit(EXIT_SUCCESS);
 }
