Index: /trunk/dbconfig/config.md
===================================================================
--- /trunk/dbconfig/config.md	(revision 11076)
+++ /trunk/dbconfig/config.md	(revision 11077)
@@ -2,4 +2,4 @@
     pkg_name        STR     ippdb
     pkg_namespace   STR     ippdb
-    pkg_version     STR     0.0.73
+    pkg_version     STR     0.0.74
 END
Index: /trunk/ippdb/configure.ac
===================================================================
--- /trunk/ippdb/configure.ac	(revision 11076)
+++ /trunk/ippdb/configure.ac	(revision 11077)
@@ -7,5 +7,5 @@
 AC_PREREQ(2.59)
 
-AC_INIT([ippdb], [0.0.73], [pan-starrs.ifa.hawaii.edu])
+AC_INIT([ippdb], [0.0.74], [pan-starrs.ifa.hawaii.edu])
 AC_CONFIG_SRCDIR([ippdb.pc.in])
 
Index: /trunk/ippdb/src/ippdb.c
===================================================================
--- /trunk/ippdb/src/ippdb.c	(revision 11076)
+++ /trunk/ippdb/src/ippdb.c	(revision 11077)
@@ -7084,5 +7084,5 @@
 static void p3PendingExpRowFree(p3PendingExpRow *object);
 
-p3PendingExpRow *p3PendingExpRowAlloc(const char *exp_tag, psS32 p2_version, psS32 p3_version, const char *label, psS16 fault)
+p3PendingExpRow *p3PendingExpRowAlloc(const char *exp_tag, psS32 p2_version, psS32 p3_version, const char *label)
 {
     p3PendingExpRow *_object;
@@ -7095,5 +7095,4 @@
     _object->p3_version = p3_version;
     _object->label = psStringCopy(label);
-    _object->fault = fault;
 
     return _object;
@@ -7129,9 +7128,4 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
-        psFree(md);
-        return false;
-    }
 
     bool status = psDBCreateTable(dbh, P3PENDINGEXP_TABLE_NAME, md);
@@ -7147,5 +7141,5 @@
 }
 
-bool p3PendingExpInsert(psDB * dbh, const char *exp_tag, psS32 p2_version, psS32 p3_version, const char *label, psS16 fault)
+bool p3PendingExpInsert(psDB * dbh, const char *exp_tag, psS32 p2_version, psS32 p3_version, const char *label)
 {
     psMetadata *md = psMetadataAlloc();
@@ -7167,9 +7161,4 @@
     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, "fault", PS_DATA_S16, NULL, fault)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
         psFree(md);
         return false;
@@ -7198,5 +7187,5 @@
 bool p3PendingExpInsertObject(psDB *dbh, p3PendingExpRow *object)
 {
-    return p3PendingExpInsert(dbh, object->exp_tag, object->p2_version, object->p3_version, object->label, object->fault);
+    return p3PendingExpInsert(dbh, object->exp_tag, object->p2_version, object->p3_version, object->label);
 }
 
@@ -7291,9 +7280,4 @@
         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");
-        psFree(md);
-        return false;
-    }
 
 
@@ -7325,11 +7309,6 @@
         return false;
     }
-    psS16 fault = psMetadataLookupS16(&status, md, "fault");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault");
-        return false;
-    }
-
-    return p3PendingExpRowAlloc(exp_tag, p2_version, p3_version, label, fault);
+
+    return p3PendingExpRowAlloc(exp_tag, p2_version, p3_version, label);
 }
 psArray *p3PendingExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
@@ -7443,5 +7422,5 @@
 static void p3ProcessedExpRowFree(p3ProcessedExpRow *object);
 
-p3ProcessedExpRow *p3ProcessedExpRowAlloc(const char *exp_tag, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF32 sigma_ra, psF32 sigma_dec, psS32 nastro, const char *b1_uri, const char *b2_uri, psF32 zp_mean, psF32 zp_stdev, psS32 p2_version, psS32 p3_version, const char *label)
+p3ProcessedExpRow *p3ProcessedExpRowAlloc(const char *exp_tag, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF32 sigma_ra, psF32 sigma_dec, psS32 nastro, const char *b1_uri, const char *b2_uri, psF32 zp_mean, psF32 zp_stdev, psS32 p2_version, psS32 p3_version, const char *label, psS16 fault)
 {
     p3ProcessedExpRow *_object;
@@ -7466,4 +7445,5 @@
     _object->p3_version = p3_version;
     _object->label = psStringCopy(label);
+    _object->fault = fault;
 
     return _object;
@@ -7563,4 +7543,9 @@
         return false;
     }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
+        psFree(md);
+        return false;
+    }
 
     bool status = psDBCreateTable(dbh, P3PROCESSEDEXP_TABLE_NAME, md);
@@ -7576,5 +7561,5 @@
 }
 
-bool p3ProcessedExpInsert(psDB * dbh, const char *exp_tag, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF32 sigma_ra, psF32 sigma_dec, psS32 nastro, const char *b1_uri, const char *b2_uri, psF32 zp_mean, psF32 zp_stdev, psS32 p2_version, psS32 p3_version, const char *label)
+bool p3ProcessedExpInsert(psDB * dbh, const char *exp_tag, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF32 sigma_ra, psF32 sigma_dec, psS32 nastro, const char *b1_uri, const char *b2_uri, psF32 zp_mean, psF32 zp_stdev, psS32 p2_version, psS32 p3_version, const char *label, psS16 fault)
 {
     psMetadata *md = psMetadataAlloc();
@@ -7656,4 +7641,9 @@
     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, "fault", PS_DATA_S16, NULL, fault)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
         psFree(md);
         return false;
@@ -7682,5 +7672,5 @@
 bool p3ProcessedExpInsertObject(psDB *dbh, p3ProcessedExpRow *object)
 {
-    return p3ProcessedExpInsert(dbh, object->exp_tag, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->sigma_ra, object->sigma_dec, object->nastro, object->b1_uri, object->b2_uri, object->zp_mean, object->zp_stdev, object->p2_version, object->p3_version, object->label);
+    return p3ProcessedExpInsert(dbh, object->exp_tag, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->sigma_ra, object->sigma_dec, object->nastro, object->b1_uri, object->b2_uri, object->zp_mean, object->zp_stdev, object->p2_version, object->p3_version, object->label, object->fault);
 }
 
@@ -7835,4 +7825,9 @@
         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");
+        psFree(md);
+        return false;
+    }
 
 
@@ -7924,6 +7919,11 @@
         return false;
     }
-
-    return p3ProcessedExpRowAlloc(exp_tag, uri, recipe, bg, bg_stdev, bg_mean_stdev, sigma_ra, sigma_dec, nastro, b1_uri, b2_uri, zp_mean, zp_stdev, p2_version, p3_version, label);
+    psS16 fault = psMetadataLookupS16(&status, md, "fault");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault");
+        return false;
+    }
+
+    return p3ProcessedExpRowAlloc(exp_tag, uri, recipe, bg, bg_stdev, bg_mean_stdev, sigma_ra, sigma_dec, nastro, b1_uri, b2_uri, zp_mean, zp_stdev, p2_version, p3_version, label, fault);
 }
 psArray *p3ProcessedExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Index: /trunk/ippdb/src/ippdb.h
===================================================================
--- /trunk/ippdb/src/ippdb.h	(revision 11076)
+++ /trunk/ippdb/src/ippdb.h	(revision 11077)
@@ -3753,5 +3753,4 @@
     psS32           p3_version;
     char            *label;
-    psS16           fault;
 } p3PendingExpRow;
 
@@ -3765,6 +3764,5 @@
     psS32           p2_version,
     psS32           p3_version,
-    const char      *label,
-    psS16           fault
+    const char      *label
 );
 
@@ -3799,6 +3797,5 @@
     psS32           p2_version,
     psS32           p3_version,
-    const char      *label,
-    psS16           fault
+    const char      *label
 );
 
@@ -3972,4 +3969,5 @@
     psS32           p3_version;
     char            *label;
+    psS16           fault;
 } p3ProcessedExpRow;
 
@@ -3995,5 +3993,6 @@
     psS32           p2_version,
     psS32           p3_version,
-    const char      *label
+    const char      *label,
+    psS16           fault
 );
 
@@ -4040,5 +4039,6 @@
     psS32           p2_version,
     psS32           p3_version,
-    const char      *label
+    const char      *label,
+    psS16           fault
 );
 
Index: /trunk/ippdb/tests/alloc.c
===================================================================
--- /trunk/ippdb/tests/alloc.c	(revision 11076)
+++ /trunk/ippdb/tests/alloc.c	(revision 11077)
@@ -696,5 +696,5 @@
         p3PendingExpRow *object;
 
-        object = p3PendingExpRowAlloc("a string", -32, -32, "a string", -16    );
+        object = p3PendingExpRowAlloc("a string", -32, -32, "a string"    );
 
         if (!object) {
@@ -718,7 +718,4 @@
             exit(EXIT_FAILURE);
         }
-            psFree(object);
-            exit(EXIT_FAILURE);
-        }
 
         psFree(object);
@@ -728,5 +725,5 @@
         p3ProcessedExpRow *object;
 
-        object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32, "a string"    );
+        object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32, "a string", -16    );
 
         if (!object) {
@@ -795,4 +792,7 @@
         }
         if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
             psFree(object);
             exit(EXIT_FAILURE);
Index: /trunk/ippdb/tests/insert.c
===================================================================
--- /trunk/ippdb/tests/insert.c	(revision 11076)
+++ /trunk/ippdb/tests/insert.c	(revision 11077)
@@ -268,20 +268,20 @@
         }
 
-        if (!p3PendingExpInsert(dbh, "a string", -32, -32, "a string", -16)) {
-            exit(EXIT_FAILURE);
-        }
-
-        psDBCleanup(dbh);
-    }
-
-    {
-        psDB            *dbh;
-
-        dbh = psDBInit("localhost", "test", NULL, "test");
-        if (!dbh) {
-            exit(EXIT_FAILURE);
-        }
-
-        if (!p3ProcessedExpInsert(dbh, "a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32, "a string")) {
+        if (!p3PendingExpInsert(dbh, "a string", -32, -32, "a string")) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!p3ProcessedExpInsert(dbh, "a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32, "a string", -16)) {
             exit(EXIT_FAILURE);
         }
Index: /trunk/ippdb/tests/insertobject.c
===================================================================
--- /trunk/ippdb/tests/insertobject.c	(revision 11076)
+++ /trunk/ippdb/tests/insertobject.c	(revision 11077)
@@ -388,5 +388,5 @@
         }
 
-        object = p3PendingExpRowAlloc("a string", -32, -32, "a string", -16);
+        object = p3PendingExpRowAlloc("a string", -32, -32, "a string");
         if (!object) {
             exit(EXIT_FAILURE);
@@ -410,5 +410,5 @@
         }
 
-        object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32, "a string");
+        object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32, "a string", -16);
         if (!object) {
             exit(EXIT_FAILURE);
Index: /trunk/ippdb/tests/metadatafromobject.c
===================================================================
--- /trunk/ippdb/tests/metadatafromobject.c	(revision 11076)
+++ /trunk/ippdb/tests/metadatafromobject.c	(revision 11077)
@@ -834,5 +834,5 @@
         bool            status;
 
-        object = p3PendingExpRowAlloc("a string", -32, -32, "a string", -16);
+        object = p3PendingExpRowAlloc("a string", -32, -32, "a string");
         if (!object) {
             exit(EXIT_FAILURE);
@@ -862,7 +862,4 @@
             exit(EXIT_FAILURE);
         }
-            psFree(md);
-            exit(EXIT_FAILURE);
-        }
 
         psFree(md);
@@ -874,5 +871,5 @@
         bool            status;
 
-        object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32, "a string");
+        object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32, "a string", -16);
         if (!object) {
             exit(EXIT_FAILURE);
@@ -947,4 +944,7 @@
         }
         if (strncmp(psMetadataLookupPtr(&status, md, "label"), "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 11076)
+++ /trunk/ippdb/tests/objectfrommetadata.c	(revision 11077)
@@ -1263,7 +1263,4 @@
             exit(EXIT_FAILURE);
         }
-            psFree(md);
-            exit(EXIT_FAILURE);
-        }
 
         object = p3PendingExpObjectFromMetadata(md);
@@ -1291,7 +1288,4 @@
             exit(EXIT_FAILURE);
         }
-            psFree(object);
-            exit(EXIT_FAILURE);
-        }
 
         psFree(object);
@@ -1367,4 +1361,7 @@
             exit(EXIT_FAILURE);
         }
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
 
         object = p3ProcessedExpObjectFromMetadata(md);
@@ -1437,4 +1434,7 @@
         }
         if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
             psFree(object);
             exit(EXIT_FAILURE);
