Index: /trunk/dbconfig/config.md
===================================================================
--- /trunk/dbconfig/config.md	(revision 11029)
+++ /trunk/dbconfig/config.md	(revision 11030)
@@ -2,4 +2,4 @@
     pkg_name        STR     ippdb
     pkg_namespace   STR     ippdb
-    pkg_version     STR     0.0.71
+    pkg_version     STR     0.0.72
 END
Index: /trunk/dbconfig/tasks.md
===================================================================
--- /trunk/dbconfig/tasks.md	(revision 11029)
+++ /trunk/dbconfig/tasks.md	(revision 11030)
@@ -1,3 +1,3 @@
-# $Id: tasks.md,v 1.103 2007-01-11 04:43:37 jhoblitt Exp $
+# $Id: tasks.md,v 1.104 2007-01-11 21:59:35 jhoblitt Exp $
 
 # this table records all exposure ID ever seen from the summit
@@ -192,5 +192,4 @@
     p2_version  S32         0
     label       STR         64      # key
-    fault       S16         0       # NOT NULL
 END
 
@@ -204,5 +203,4 @@
     p1_version  S32         0
     p2_version  S32         0
-    fault       S16         0       # NOT NULL
 END
 
@@ -236,4 +234,5 @@
     p1_version  S32         0
     p2_version  S32         0
+    fault       S16         0       # NOT NULL
 END
 
Index: /trunk/ippdb/configure.ac
===================================================================
--- /trunk/ippdb/configure.ac	(revision 11029)
+++ /trunk/ippdb/configure.ac	(revision 11030)
@@ -7,5 +7,5 @@
 AC_PREREQ(2.59)
 
-AC_INIT([ippdb], [0.0.71], [pan-starrs.ifa.hawaii.edu])
+AC_INIT([ippdb], [0.0.72], [pan-starrs.ifa.hawaii.edu])
 AC_CONFIG_SRCDIR([ippdb.pc.in])
 
Index: /trunk/ippdb/src/ippdb.c
===================================================================
--- /trunk/ippdb/src/ippdb.c	(revision 11029)
+++ /trunk/ippdb/src/ippdb.c	(revision 11030)
@@ -5879,5 +5879,5 @@
 static void p2PendingExpRowFree(p2PendingExpRow *object);
 
-p2PendingExpRow *p2PendingExpRowAlloc(const char *exp_tag, const char *recipe, psS32 p1_version, psS32 p2_version, const char *label, psS16 fault)
+p2PendingExpRow *p2PendingExpRowAlloc(const char *exp_tag, const char *recipe, psS32 p1_version, psS32 p2_version, const char *label)
 {
     p2PendingExpRow *_object;
@@ -5891,5 +5891,4 @@
     _object->p2_version = p2_version;
     _object->label = psStringCopy(label);
-    _object->fault = fault;
 
     return _object;
@@ -5931,9 +5930,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, P2PENDINGEXP_TABLE_NAME, md);
@@ -5949,5 +5943,5 @@
 }
 
-bool p2PendingExpInsert(psDB * dbh, const char *exp_tag, const char *recipe, psS32 p1_version, psS32 p2_version, const char *label, psS16 fault)
+bool p2PendingExpInsert(psDB * dbh, const char *exp_tag, const char *recipe, psS32 p1_version, psS32 p2_version, const char *label)
 {
     psMetadata *md = psMetadataAlloc();
@@ -5974,9 +5968,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;
@@ -6005,5 +5994,5 @@
 bool p2PendingExpInsertObject(psDB *dbh, p2PendingExpRow *object)
 {
-    return p2PendingExpInsert(dbh, object->exp_tag, object->recipe, object->p1_version, object->p2_version, object->label, object->fault);
+    return p2PendingExpInsert(dbh, object->exp_tag, object->recipe, object->p1_version, object->p2_version, object->label);
 }
 
@@ -6103,9 +6092,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;
-    }
 
 
@@ -6142,11 +6126,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 p2PendingExpRowAlloc(exp_tag, recipe, p1_version, p2_version, label, fault);
+
+    return p2PendingExpRowAlloc(exp_tag, recipe, p1_version, p2_version, label);
 }
 psArray *p2PendingExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
@@ -6260,5 +6239,5 @@
 static void p2PendingImfileRowFree(p2PendingImfileRow *object);
 
-p2PendingImfileRow *p2PendingImfileRowAlloc(const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psS32 p1_version, psS32 p2_version, psS16 fault)
+p2PendingImfileRow *p2PendingImfileRowAlloc(const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psS32 p1_version, psS32 p2_version)
 {
     p2PendingImfileRow *_object;
@@ -6273,5 +6252,4 @@
     _object->p1_version = p1_version;
     _object->p2_version = p2_version;
-    _object->fault = fault;
 
     return _object;
@@ -6319,9 +6297,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, P2PENDINGIMFILE_TABLE_NAME, md);
@@ -6337,5 +6310,5 @@
 }
 
-bool p2PendingImfileInsert(psDB * dbh, const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psS32 p1_version, psS32 p2_version, psS16 fault)
+bool p2PendingImfileInsert(psDB * dbh, const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psS32 p1_version, psS32 p2_version)
 {
     psMetadata *md = psMetadataAlloc();
@@ -6367,9 +6340,4 @@
     if (!psMetadataAdd(md, PS_LIST_TAIL, "p2_version", PS_DATA_S32, NULL, p2_version)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version");
-        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;
@@ -6398,5 +6366,5 @@
 bool p2PendingImfileInsertObject(psDB *dbh, p2PendingImfileRow *object)
 {
-    return p2PendingImfileInsert(dbh, object->exp_tag, object->class_id, object->uri, object->recipe, object->p1_version, object->p2_version, object->fault);
+    return p2PendingImfileInsert(dbh, object->exp_tag, object->class_id, object->uri, object->recipe, object->p1_version, object->p2_version);
 }
 
@@ -6501,9 +6469,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;
-    }
 
 
@@ -6545,11 +6508,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 p2PendingImfileRowAlloc(exp_tag, class_id, uri, recipe, p1_version, p2_version, fault);
+
+    return p2PendingImfileRowAlloc(exp_tag, class_id, uri, recipe, p1_version, p2_version);
 }
 psArray *p2PendingImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
@@ -7275,5 +7233,5 @@
 static void p2ProcessedImfileRowFree(p2ProcessedImfileRow *object);
 
-p2ProcessedImfileRow *p2ProcessedImfileRowAlloc(const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS32 p1_version, psS32 p2_version)
+p2ProcessedImfileRow *p2ProcessedImfileRowAlloc(const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS32 p1_version, psS32 p2_version, psS16 fault)
 {
     p2ProcessedImfileRow *_object;
@@ -7293,4 +7251,5 @@
     _object->p1_version = p1_version;
     _object->p2_version = p2_version;
+    _object->fault = fault;
 
     return _object;
@@ -7365,4 +7324,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, P2PROCESSEDIMFILE_TABLE_NAME, md);
@@ -7378,5 +7342,5 @@
 }
 
-bool p2ProcessedImfileInsert(psDB * dbh, const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS32 p1_version, psS32 p2_version)
+bool p2ProcessedImfileInsert(psDB * dbh, const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS32 p1_version, psS32 p2_version, psS16 fault)
 {
     psMetadata *md = psMetadataAlloc();
@@ -7433,4 +7397,9 @@
     if (!psMetadataAdd(md, PS_LIST_TAIL, "p2_version", PS_DATA_S32, NULL, p2_version)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version");
+        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;
@@ -7459,5 +7428,5 @@
 bool p2ProcessedImfileInsertObject(psDB *dbh, p2ProcessedImfileRow *object)
 {
-    return p2ProcessedImfileInsert(dbh, object->exp_tag, object->class_id, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->b1_uri, object->b2_uri, object->p1_version, object->p2_version);
+    return p2ProcessedImfileInsert(dbh, object->exp_tag, object->class_id, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->b1_uri, object->b2_uri, object->p1_version, object->p2_version, object->fault);
 }
 
@@ -7587,4 +7556,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;
+    }
 
 
@@ -7651,6 +7625,11 @@
         return false;
     }
-
-    return p2ProcessedImfileRowAlloc(exp_tag, class_id, uri, recipe, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri, p1_version, p2_version);
+    psS16 fault = psMetadataLookupS16(&status, md, "fault");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault");
+        return false;
+    }
+
+    return p2ProcessedImfileRowAlloc(exp_tag, class_id, uri, recipe, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri, p1_version, p2_version, fault);
 }
 psArray *p2ProcessedImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Index: /trunk/ippdb/src/ippdb.h
===================================================================
--- /trunk/ippdb/src/ippdb.h	(revision 11029)
+++ /trunk/ippdb/src/ippdb.h	(revision 11030)
@@ -2959,5 +2959,4 @@
     psS32           p2_version;
     char            *label;
-    psS16           fault;
 } p2PendingExpRow;
 
@@ -2972,6 +2971,5 @@
     psS32           p1_version,
     psS32           p2_version,
-    const char      *label,
-    psS16           fault
+    const char      *label
 );
 
@@ -3007,6 +3005,5 @@
     psS32           p1_version,
     psS32           p2_version,
-    const char      *label,
-    psS16           fault
+    const char      *label
 );
 
@@ -3170,5 +3167,4 @@
     psS32           p1_version;
     psS32           p2_version;
-    psS16           fault;
 } p2PendingImfileRow;
 
@@ -3184,6 +3180,5 @@
     const char      *recipe,
     psS32           p1_version,
-    psS32           p2_version,
-    psS16           fault
+    psS32           p2_version
 );
 
@@ -3220,6 +3215,5 @@
     const char      *recipe,
     psS32           p1_version,
-    psS32           p2_version,
-    psS16           fault
+    psS32           p2_version
 );
 
@@ -3787,4 +3781,5 @@
     psS32           p1_version;
     psS32           p2_version;
+    psS16           fault;
 } p2ProcessedImfileRow;
 
@@ -3805,5 +3800,6 @@
     const char      *b2_uri,
     psS32           p1_version,
-    psS32           p2_version
+    psS32           p2_version,
+    psS16           fault
 );
 
@@ -3845,5 +3841,6 @@
     const char      *b2_uri,
     psS32           p1_version,
-    psS32           p2_version
+    psS32           p2_version,
+    psS16           fault
 );
 
Index: /trunk/ippdb/tests/alloc.c
===================================================================
--- /trunk/ippdb/tests/alloc.c	(revision 11029)
+++ /trunk/ippdb/tests/alloc.c	(revision 11030)
@@ -608,5 +608,5 @@
         p2PendingExpRow *object;
 
-        object = p2PendingExpRowAlloc("a string", "a string", -32, -32, "a string", -16    );
+        object = p2PendingExpRowAlloc("a string", "a string", -32, -32, "a string"    );
 
         if (!object) {
@@ -634,7 +634,4 @@
             exit(EXIT_FAILURE);
         }
-            psFree(object);
-            exit(EXIT_FAILURE);
-        }
 
         psFree(object);
@@ -644,5 +641,5 @@
         p2PendingImfileRow *object;
 
-        object = p2PendingImfileRowAlloc("a string", "a string", "a string", "a string", -32, -32, -16    );
+        object = p2PendingImfileRowAlloc("a string", "a string", "a string", "a string", -32, -32    );
 
         if (!object) {
@@ -674,7 +671,4 @@
             exit(EXIT_FAILURE);
         }
-            psFree(object);
-            exit(EXIT_FAILURE);
-        }
 
         psFree(object);
@@ -730,5 +724,5 @@
         p2ProcessedImfileRow *object;
 
-        object = p2ProcessedImfileRowAlloc("a string", "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -32, -32    );
+        object = p2ProcessedImfileRowAlloc("a string", "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -32, -32, -16    );
 
         if (!object) {
@@ -777,4 +771,7 @@
         }
         if (!object->p2_version == -32) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
             psFree(object);
             exit(EXIT_FAILURE);
Index: /trunk/ippdb/tests/insert.c
===================================================================
--- /trunk/ippdb/tests/insert.c	(revision 11029)
+++ /trunk/ippdb/tests/insert.c	(revision 11030)
@@ -208,20 +208,20 @@
         }
 
-        if (!p2PendingExpInsert(dbh, "a string", "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 (!p2PendingImfileInsert(dbh, "a string", "a string", "a string", "a string", -32, -32, -16)) {
+        if (!p2PendingExpInsert(dbh, "a string", "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 (!p2PendingImfileInsert(dbh, "a string", "a string", "a string", "a string", -32, -32)) {
             exit(EXIT_FAILURE);
         }
@@ -268,5 +268,5 @@
         }
 
-        if (!p2ProcessedImfileInsert(dbh, "a string", "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -32, -32)) {
+        if (!p2ProcessedImfileInsert(dbh, "a string", "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -32, -32, -16)) {
             exit(EXIT_FAILURE);
         }
Index: /trunk/ippdb/tests/insertobject.c
===================================================================
--- /trunk/ippdb/tests/insertobject.c	(revision 11029)
+++ /trunk/ippdb/tests/insertobject.c	(revision 11030)
@@ -300,5 +300,5 @@
         }
 
-        object = p2PendingExpRowAlloc("a string", "a string", -32, -32, "a string", -16);
+        object = p2PendingExpRowAlloc("a string", "a string", -32, -32, "a string");
         if (!object) {
             exit(EXIT_FAILURE);
@@ -322,5 +322,5 @@
         }
 
-        object = p2PendingImfileRowAlloc("a string", "a string", "a string", "a string", -32, -32, -16);
+        object = p2PendingImfileRowAlloc("a string", "a string", "a string", "a string", -32, -32);
         if (!object) {
             exit(EXIT_FAILURE);
@@ -388,5 +388,5 @@
         }
 
-        object = p2ProcessedImfileRowAlloc("a string", "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -32, -32);
+        object = p2ProcessedImfileRowAlloc("a string", "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -32, -32, -16);
         if (!object) {
             exit(EXIT_FAILURE);
Index: /trunk/ippdb/tests/metadatafromobject.c
===================================================================
--- /trunk/ippdb/tests/metadatafromobject.c	(revision 11029)
+++ /trunk/ippdb/tests/metadatafromobject.c	(revision 11030)
@@ -714,5 +714,5 @@
         bool            status;
 
-        object = p2PendingExpRowAlloc("a string", "a string", -32, -32, "a string", -16);
+        object = p2PendingExpRowAlloc("a string", "a string", -32, -32, "a string");
         if (!object) {
             exit(EXIT_FAILURE);
@@ -746,7 +746,4 @@
             exit(EXIT_FAILURE);
         }
-            psFree(md);
-            exit(EXIT_FAILURE);
-        }
 
         psFree(md);
@@ -758,5 +755,5 @@
         bool            status;
 
-        object = p2PendingImfileRowAlloc("a string", "a string", "a string", "a string", -32, -32, -16);
+        object = p2PendingImfileRowAlloc("a string", "a string", "a string", "a string", -32, -32);
         if (!object) {
             exit(EXIT_FAILURE);
@@ -794,7 +791,4 @@
             exit(EXIT_FAILURE);
         }
-            psFree(md);
-            exit(EXIT_FAILURE);
-        }
 
         psFree(md);
@@ -868,5 +862,5 @@
         bool            status;
 
-        object = p2ProcessedImfileRowAlloc("a string", "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -32, -32);
+        object = p2ProcessedImfileRowAlloc("a string", "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -32, -32, -16);
         if (!object) {
             exit(EXIT_FAILURE);
@@ -921,4 +915,7 @@
         }
         if (!psMetadataLookupS32(&status, md, "p2_version") == -32) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
             psFree(md);
             exit(EXIT_FAILURE);
Index: /trunk/ippdb/tests/objectfrommetadata.c
===================================================================
--- /trunk/ippdb/tests/objectfrommetadata.c	(revision 11029)
+++ /trunk/ippdb/tests/objectfrommetadata.c	(revision 11030)
@@ -1123,7 +1123,4 @@
             exit(EXIT_FAILURE);
         }
-            psFree(md);
-            exit(EXIT_FAILURE);
-        }
 
         object = p2PendingExpObjectFromMetadata(md);
@@ -1155,7 +1152,4 @@
             exit(EXIT_FAILURE);
         }
-            psFree(object);
-            exit(EXIT_FAILURE);
-        }
 
         psFree(object);
@@ -1191,7 +1185,4 @@
             exit(EXIT_FAILURE);
         }
-            psFree(md);
-            exit(EXIT_FAILURE);
-        }
 
         object = p2PendingImfileObjectFromMetadata(md);
@@ -1227,7 +1218,4 @@
             exit(EXIT_FAILURE);
         }
-            psFree(object);
-            exit(EXIT_FAILURE);
-        }
 
         psFree(object);
@@ -1359,4 +1347,7 @@
             exit(EXIT_FAILURE);
         }
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
 
         object = p2ProcessedImfileObjectFromMetadata(md);
@@ -1409,4 +1400,7 @@
         }
         if (!object->p2_version == -32) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
             psFree(object);
             exit(EXIT_FAILURE);
