Index: /trunk/dbconfig/config.md
===================================================================
--- /trunk/dbconfig/config.md	(revision 9186)
+++ /trunk/dbconfig/config.md	(revision 9187)
@@ -2,4 +2,4 @@
     pkg_name        STR     ippdb
     pkg_namespace   STR     ippdb
-    pkg_version     STR     0.0.42
+    pkg_version     STR     0.0.43
 END
Index: /trunk/ippdb/configure.ac
===================================================================
--- /trunk/ippdb/configure.ac	(revision 9186)
+++ /trunk/ippdb/configure.ac	(revision 9187)
@@ -7,5 +7,5 @@
 AC_PREREQ(2.59)
 
-AC_INIT([ippdb], [0.0.42], [pan-starrs.ifa.hawaii.edu])
+AC_INIT([ippdb], [0.0.43], [pan-starrs.ifa.hawaii.edu])
 AC_CONFIG_SRCDIR([ippdb.pc.in])
 
Index: /trunk/ippdb/src/ippdb.c
===================================================================
--- /trunk/ippdb/src/ippdb.c	(revision 9186)
+++ /trunk/ippdb/src/ippdb.c	(revision 9187)
@@ -7194,5 +7194,5 @@
 static void rawDetrendExpRowFree(rawDetrendExpRow *object);
 
-rawDetrendExpRow *rawDetrendExpRowAlloc(const char *exp_tag, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, 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)
+rawDetrendExpRow *rawDetrendExpRowAlloc(const char *exp_tag, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, 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 *obstype)
 {
     rawDetrendExpRow *object;
@@ -7218,4 +7218,5 @@
     object->ccd_temp = ccd_temp;
     object->posang = posang;
+    object->obstype = psStringCopy(obstype);
 
     return object;
@@ -7229,4 +7230,5 @@
     psFree(object->exp_type);
     psFree(object->filter);
+    psFree(object->obstype);
 }
 
@@ -7327,4 +7329,9 @@
         return false;
     }
+    if (!psMetadataAddStr(md, PS_LIST_TAIL, "obstype", 0, NULL, "64")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item obstype");
+        psFree(md);
+        return false;
+    }
 
     status = psDBCreateTable(dbh, RAWDETRENDEXP_TABLE_NAME, md);
@@ -7340,5 +7347,5 @@
 }
 
-bool rawDetrendExpInsert(psDB * dbh, const char *exp_tag, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, 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)
+bool rawDetrendExpInsert(psDB * dbh, const char *exp_tag, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, 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 *obstype)
 {
     psMetadata      *md;
@@ -7428,4 +7435,9 @@
     if (!psMetadataAddF64(md, PS_LIST_TAIL, "posang", 0, NULL, posang)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item posang");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAddStr(md, PS_LIST_TAIL, "obstype", 0, NULL, obstype)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item obstype");
         psFree(md);
         return false;
@@ -7452,5 +7464,5 @@
     return deleted;
 }
-bool rawDetrendExpPop(psDB *dbh, char **exp_tag, char **camera, char **telescope, char **exp_type, psS32 *imfiles, 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)
+bool rawDetrendExpPop(psDB *dbh, char **exp_tag, char **camera, char **telescope, char **exp_type, psS32 *imfiles, 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, char **obstype)
 {
     psArray         *rowSet;
@@ -7598,4 +7610,10 @@
         return false;
     }
+    *obstype = psMetadataLookupPtr(&status, row, "obstype");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item obstype");
+        psFree(row);
+        return false;
+    }
 
     psFree(row);
@@ -7606,5 +7624,5 @@
 bool rawDetrendExpInsertObject(psDB *dbh, rawDetrendExpRow *object)
 {
-    return rawDetrendExpInsert(dbh, object->exp_tag, object->camera, object->telescope, object->exp_type, object->imfiles, 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);
+    return rawDetrendExpInsert(dbh, object->exp_tag, object->camera, object->telescope, object->exp_type, object->imfiles, 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->obstype);
 }
 
@@ -7639,11 +7657,12 @@
     psF32           ccd_temp;
     psF64           posang;
-
-    if (!rawDetrendExpPop(dbh, (char **)&exp_tag, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, &airmass, &ra, &decl, &exp_time, &bg, &bg_stdev, &bg_mean_stdev, &alt, &az, &ccd_temp, &posang)) {
+    char            obstype[256];
+
+    if (!rawDetrendExpPop(dbh, (char **)&exp_tag, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, &airmass, &ra, &decl, &exp_time, &bg, &bg_stdev, &bg_mean_stdev, &alt, &az, &ccd_temp, &posang, (char **)&obstype)) {
         psError(PS_ERR_UNKNOWN, false, "failed to pop a database row");
         return NULL;
     }
 
-    return rawDetrendExpRowAlloc(exp_tag, camera, telescope, exp_type, imfiles, filter, airmass, ra, decl, exp_time, bg, bg_stdev, bg_mean_stdev, alt, az, ccd_temp, posang);
+    return rawDetrendExpRowAlloc(exp_tag, camera, telescope, exp_type, imfiles, filter, airmass, ra, decl, exp_time, bg, bg_stdev, bg_mean_stdev, alt, az, ccd_temp, posang, obstype);
 }
 
@@ -7826,4 +7845,9 @@
     if (!psMetadataAddF64(md, PS_LIST_TAIL, "posang", 0, NULL, object->posang)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item posang");
+        psFree(md);
+        return NULL;
+    }
+    if (!psMetadataAddStr(md, PS_LIST_TAIL, "obstype", 0, NULL, object->obstype)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item obstype");
         psFree(md);
         return NULL;
@@ -7853,4 +7877,5 @@
     psF32           ccd_temp;
     psF64           posang;
+    char            *obstype;
 
     exp_tag = psMetadataLookupPtr(&status, md, "exp_tag");
@@ -7939,6 +7964,11 @@
         return false;
     }
-
-    return rawDetrendExpRowAlloc(exp_tag, camera, telescope, exp_type, imfiles, filter, airmass, ra, decl, exp_time, bg, bg_stdev, bg_mean_stdev, alt, az, ccd_temp, posang);
+    obstype = psMetadataLookupPtr(&status, md, "obstype");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item obstype");
+        return false;
+    }
+
+    return rawDetrendExpRowAlloc(exp_tag, camera, telescope, exp_type, imfiles, filter, airmass, ra, decl, exp_time, bg, bg_stdev, bg_mean_stdev, alt, az, ccd_temp, posang, obstype);
 }
 psArray *rawDetrendExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
@@ -8047,5 +8077,5 @@
 static void rawScienceExpRowFree(rawScienceExpRow *object);
 
-rawScienceExpRow *rawScienceExpRowAlloc(const char *exp_tag, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, 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)
+rawScienceExpRow *rawScienceExpRowAlloc(const char *exp_tag, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, 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 *obstype)
 {
     rawScienceExpRow *object;
@@ -8071,4 +8101,5 @@
     object->ccd_temp = ccd_temp;
     object->posang = posang;
+    object->obstype = psStringCopy(obstype);
 
     return object;
@@ -8082,4 +8113,5 @@
     psFree(object->exp_type);
     psFree(object->filter);
+    psFree(object->obstype);
 }
 
@@ -8180,4 +8212,9 @@
         return false;
     }
+    if (!psMetadataAddStr(md, PS_LIST_TAIL, "obstype", 0, NULL, "64")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item obstype");
+        psFree(md);
+        return false;
+    }
 
     status = psDBCreateTable(dbh, RAWSCIENCEEXP_TABLE_NAME, md);
@@ -8193,5 +8230,5 @@
 }
 
-bool rawScienceExpInsert(psDB * dbh, const char *exp_tag, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, 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)
+bool rawScienceExpInsert(psDB * dbh, const char *exp_tag, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, 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 *obstype)
 {
     psMetadata      *md;
@@ -8281,4 +8318,9 @@
     if (!psMetadataAddF64(md, PS_LIST_TAIL, "posang", 0, NULL, posang)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item posang");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAddStr(md, PS_LIST_TAIL, "obstype", 0, NULL, obstype)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item obstype");
         psFree(md);
         return false;
@@ -8305,5 +8347,5 @@
     return deleted;
 }
-bool rawScienceExpPop(psDB *dbh, char **exp_tag, char **camera, char **telescope, char **exp_type, psS32 *imfiles, 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)
+bool rawScienceExpPop(psDB *dbh, char **exp_tag, char **camera, char **telescope, char **exp_type, psS32 *imfiles, 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, char **obstype)
 {
     psArray         *rowSet;
@@ -8451,4 +8493,10 @@
         return false;
     }
+    *obstype = psMetadataLookupPtr(&status, row, "obstype");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item obstype");
+        psFree(row);
+        return false;
+    }
 
     psFree(row);
@@ -8459,5 +8507,5 @@
 bool rawScienceExpInsertObject(psDB *dbh, rawScienceExpRow *object)
 {
-    return rawScienceExpInsert(dbh, object->exp_tag, object->camera, object->telescope, object->exp_type, object->imfiles, 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);
+    return rawScienceExpInsert(dbh, object->exp_tag, object->camera, object->telescope, object->exp_type, object->imfiles, 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->obstype);
 }
 
@@ -8492,11 +8540,12 @@
     psF32           ccd_temp;
     psF64           posang;
-
-    if (!rawScienceExpPop(dbh, (char **)&exp_tag, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, &airmass, &ra, &decl, &exp_time, &bg, &bg_stdev, &bg_mean_stdev, &alt, &az, &ccd_temp, &posang)) {
+    char            obstype[256];
+
+    if (!rawScienceExpPop(dbh, (char **)&exp_tag, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, &airmass, &ra, &decl, &exp_time, &bg, &bg_stdev, &bg_mean_stdev, &alt, &az, &ccd_temp, &posang, (char **)&obstype)) {
         psError(PS_ERR_UNKNOWN, false, "failed to pop a database row");
         return NULL;
     }
 
-    return rawScienceExpRowAlloc(exp_tag, camera, telescope, exp_type, imfiles, filter, airmass, ra, decl, exp_time, bg, bg_stdev, bg_mean_stdev, alt, az, ccd_temp, posang);
+    return rawScienceExpRowAlloc(exp_tag, camera, telescope, exp_type, imfiles, filter, airmass, ra, decl, exp_time, bg, bg_stdev, bg_mean_stdev, alt, az, ccd_temp, posang, obstype);
 }
 
@@ -8679,4 +8728,9 @@
     if (!psMetadataAddF64(md, PS_LIST_TAIL, "posang", 0, NULL, object->posang)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item posang");
+        psFree(md);
+        return NULL;
+    }
+    if (!psMetadataAddStr(md, PS_LIST_TAIL, "obstype", 0, NULL, object->obstype)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item obstype");
         psFree(md);
         return NULL;
@@ -8706,4 +8760,5 @@
     psF32           ccd_temp;
     psF64           posang;
+    char            *obstype;
 
     exp_tag = psMetadataLookupPtr(&status, md, "exp_tag");
@@ -8792,6 +8847,11 @@
         return false;
     }
-
-    return rawScienceExpRowAlloc(exp_tag, camera, telescope, exp_type, imfiles, filter, airmass, ra, decl, exp_time, bg, bg_stdev, bg_mean_stdev, alt, az, ccd_temp, posang);
+    obstype = psMetadataLookupPtr(&status, md, "obstype");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item obstype");
+        return false;
+    }
+
+    return rawScienceExpRowAlloc(exp_tag, camera, telescope, exp_type, imfiles, filter, airmass, ra, decl, exp_time, bg, bg_stdev, bg_mean_stdev, alt, az, ccd_temp, posang, obstype);
 }
 psArray *rawScienceExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
@@ -8900,5 +8960,5 @@
 static void rawImfileRowFree(rawImfileRow *object);
 
-rawImfileRow *rawImfileRowAlloc(const char *exp_tag, const char *class, const char *class_id, const char *uri, const char *exp_type, 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)
+rawImfileRow *rawImfileRowAlloc(const char *exp_tag, const char *class, const char *class_id, const char *uri, const char *exp_type, 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 *obstype)
 {
     rawImfileRow    *object;
@@ -8924,4 +8984,5 @@
     object->ccd_temp = ccd_temp;
     object->posang = posang;
+    object->obstype = psStringCopy(obstype);
 
     return object;
@@ -8936,4 +8997,5 @@
     psFree(object->exp_type);
     psFree(object->filter);
+    psFree(object->obstype);
 }
 
@@ -9034,4 +9096,9 @@
         return false;
     }
+    if (!psMetadataAddStr(md, PS_LIST_TAIL, "obstype", 0, NULL, "64")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item obstype");
+        psFree(md);
+        return false;
+    }
 
     status = psDBCreateTable(dbh, RAWIMFILE_TABLE_NAME, md);
@@ -9047,5 +9114,5 @@
 }
 
-bool rawImfileInsert(psDB * dbh, const char *exp_tag, const char *class, const char *class_id, const char *uri, const char *exp_type, 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)
+bool rawImfileInsert(psDB * dbh, const char *exp_tag, const char *class, const char *class_id, const char *uri, const char *exp_type, 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 *obstype)
 {
     psMetadata      *md;
@@ -9135,4 +9202,9 @@
     if (!psMetadataAddF64(md, PS_LIST_TAIL, "posang", 0, NULL, posang)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item posang");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAddStr(md, PS_LIST_TAIL, "obstype", 0, NULL, obstype)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item obstype");
         psFree(md);
         return false;
@@ -9159,5 +9231,5 @@
     return deleted;
 }
-bool rawImfilePop(psDB *dbh, char **exp_tag, char **class, char **class_id, char **uri, char **exp_type, 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)
+bool rawImfilePop(psDB *dbh, char **exp_tag, char **class, char **class_id, char **uri, char **exp_type, 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, char **obstype)
 {
     psArray         *rowSet;
@@ -9305,4 +9377,10 @@
         return false;
     }
+    *obstype = psMetadataLookupPtr(&status, row, "obstype");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item obstype");
+        psFree(row);
+        return false;
+    }
 
     psFree(row);
@@ -9313,5 +9391,5 @@
 bool rawImfileInsertObject(psDB *dbh, rawImfileRow *object)
 {
-    return rawImfileInsert(dbh, object->exp_tag, object->class, object->class_id, object->uri, object->exp_type, 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);
+    return rawImfileInsert(dbh, object->exp_tag, object->class, object->class_id, object->uri, object->exp_type, 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->obstype);
 }
 
@@ -9346,11 +9424,12 @@
     psF32           ccd_temp;
     psF64           posang;
-
-    if (!rawImfilePop(dbh, (char **)&exp_tag, (char **)&class, (char **)&class_id, (char **)&uri, (char **)&exp_type, (char **)&filter, &airmass, &ra, &decl, &exp_time, &bg, &bg_stdev, &bg_mean_stdev, &alt, &az, &ccd_temp, &posang)) {
+    char            obstype[256];
+
+    if (!rawImfilePop(dbh, (char **)&exp_tag, (char **)&class, (char **)&class_id, (char **)&uri, (char **)&exp_type, (char **)&filter, &airmass, &ra, &decl, &exp_time, &bg, &bg_stdev, &bg_mean_stdev, &alt, &az, &ccd_temp, &posang, (char **)&obstype)) {
         psError(PS_ERR_UNKNOWN, false, "failed to pop a database row");
         return NULL;
     }
 
-    return rawImfileRowAlloc(exp_tag, class, class_id, uri, exp_type, filter, airmass, ra, decl, exp_time, bg, bg_stdev, bg_mean_stdev, alt, az, ccd_temp, posang);
+    return rawImfileRowAlloc(exp_tag, class, class_id, uri, exp_type, filter, airmass, ra, decl, exp_time, bg, bg_stdev, bg_mean_stdev, alt, az, ccd_temp, posang, obstype);
 }
 
@@ -9533,4 +9612,9 @@
     if (!psMetadataAddF64(md, PS_LIST_TAIL, "posang", 0, NULL, object->posang)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item posang");
+        psFree(md);
+        return NULL;
+    }
+    if (!psMetadataAddStr(md, PS_LIST_TAIL, "obstype", 0, NULL, object->obstype)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item obstype");
         psFree(md);
         return NULL;
@@ -9560,4 +9644,5 @@
     psF32           ccd_temp;
     psF64           posang;
+    char            *obstype;
 
     exp_tag = psMetadataLookupPtr(&status, md, "exp_tag");
@@ -9646,6 +9731,11 @@
         return false;
     }
-
-    return rawImfileRowAlloc(exp_tag, class, class_id, uri, exp_type, filter, airmass, ra, decl, exp_time, bg, bg_stdev, bg_mean_stdev, alt, az, ccd_temp, posang);
+    obstype = psMetadataLookupPtr(&status, md, "obstype");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item obstype");
+        return false;
+    }
+
+    return rawImfileRowAlloc(exp_tag, class, class_id, uri, exp_type, filter, airmass, ra, decl, exp_time, bg, bg_stdev, bg_mean_stdev, alt, az, ccd_temp, posang, obstype);
 }
 psArray *rawImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Index: /trunk/ippdb/src/ippdb.h
===================================================================
--- /trunk/ippdb/src/ippdb.h	(revision 9186)
+++ /trunk/ippdb/src/ippdb.h	(revision 9187)
@@ -3187,4 +3187,5 @@
     psF32           ccd_temp;
     psF64           posang;
+    char            *obstype;
 } rawDetrendExpRow;
 
@@ -3211,5 +3212,6 @@
     psF64           az,
     psF32           ccd_temp,
-    psF64           posang
+    psF64           posang,
+    const char      *obstype
 );
 
@@ -3257,5 +3259,6 @@
     psF64           az,
     psF32           ccd_temp,
-    psF64           posang
+    psF64           posang,
+    const char      *obstype
 );
 
@@ -3294,5 +3297,6 @@
     psF64           *az,
     psF32           *ccd_temp,
-    psF64           *posang
+    psF64           *posang,
+    char            **obstype
 );
 
@@ -3466,4 +3470,5 @@
     psF32           ccd_temp;
     psF64           posang;
+    char            *obstype;
 } rawScienceExpRow;
 
@@ -3490,5 +3495,6 @@
     psF64           az,
     psF32           ccd_temp,
-    psF64           posang
+    psF64           posang,
+    const char      *obstype
 );
 
@@ -3536,5 +3542,6 @@
     psF64           az,
     psF32           ccd_temp,
-    psF64           posang
+    psF64           posang,
+    const char      *obstype
 );
 
@@ -3573,5 +3580,6 @@
     psF64           *az,
     psF32           *ccd_temp,
-    psF64           *posang
+    psF64           *posang,
+    char            **obstype
 );
 
@@ -3745,4 +3753,5 @@
     psF32           ccd_temp;
     psF64           posang;
+    char            *obstype;
 } rawImfileRow;
 
@@ -3769,5 +3778,6 @@
     psF64           az,
     psF32           ccd_temp,
-    psF64           posang
+    psF64           posang,
+    const char      *obstype
 );
 
@@ -3815,5 +3825,6 @@
     psF64           az,
     psF32           ccd_temp,
-    psF64           posang
+    psF64           posang,
+    const char      *obstype
 );
 
@@ -3852,5 +3863,6 @@
     psF64           *az,
     psF32           *ccd_temp,
-    psF64           *posang
+    psF64           *posang,
+    char            **obstype
 );
 
Index: /trunk/ippdb/tests/alloc.c
===================================================================
--- /trunk/ippdb/tests/alloc.c	(revision 9186)
+++ /trunk/ippdb/tests/alloc.c	(revision 9187)
@@ -496,5 +496,5 @@
         rawDetrendExpRow *object;
 
-        object = rawDetrendExpRowAlloc("a string", "a string", "a string", "a string", -32, "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64    );
+        object = rawDetrendExpRowAlloc("a string", "a string", "a string", "a string", -32, "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"    );
 
         if (!object) {
@@ -570,4 +570,8 @@
             exit(EXIT_FAILURE);
         }
+        if (strncmp(object->obstype, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
 
         psFree(object);
@@ -577,5 +581,5 @@
         rawScienceExpRow *object;
 
-        object = rawScienceExpRowAlloc("a string", "a string", "a string", "a string", -32, "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64    );
+        object = rawScienceExpRowAlloc("a string", "a string", "a string", "a string", -32, "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"    );
 
         if (!object) {
@@ -651,4 +655,8 @@
             exit(EXIT_FAILURE);
         }
+        if (strncmp(object->obstype, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
 
         psFree(object);
@@ -658,5 +666,5 @@
         rawImfileRow    *object;
 
-        object = rawImfileRowAlloc("a string", "a string", "a string", "a string", "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    );
+        object = rawImfileRowAlloc("a string", "a string", "a string", "a string", "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"    );
 
         if (!object) {
@@ -729,4 +737,8 @@
         }
         if (!object->posang == 64.64) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->obstype, "a string", MAX_STRING_LENGTH)) {
             psFree(object);
             exit(EXIT_FAILURE);
Index: /trunk/ippdb/tests/insert.c
===================================================================
--- /trunk/ippdb/tests/insert.c	(revision 9186)
+++ /trunk/ippdb/tests/insert.c	(revision 9187)
@@ -208,35 +208,35 @@
         }
 
-        if (!rawDetrendExpInsert(dbh, "a string", "a string", "a string", "a string", -32, "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64)) {
-            exit(EXIT_FAILURE);
-        }
-
-        psDBCleanup(dbh);
-    }
-
-    {
-        psDB            *dbh;
-
-        dbh = psDBInit("localhost", "test", NULL, "test");
-        if (!dbh) {
-            exit(EXIT_FAILURE);
-        }
-
-        if (!rawScienceExpInsert(dbh, "a string", "a string", "a string", "a string", -32, "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64)) {
-            exit(EXIT_FAILURE);
-        }
-
-        psDBCleanup(dbh);
-    }
-
-    {
-        psDB            *dbh;
-
-        dbh = psDBInit("localhost", "test", NULL, "test");
-        if (!dbh) {
-            exit(EXIT_FAILURE);
-        }
-
-        if (!rawImfileInsert(dbh, "a string", "a string", "a string", "a string", "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)) {
+        if (!rawDetrendExpInsert(dbh, "a string", "a string", "a string", "a string", -32, "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")) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!rawScienceExpInsert(dbh, "a string", "a string", "a string", "a string", -32, "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")) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!rawImfileInsert(dbh, "a string", "a string", "a string", "a string", "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")) {
             exit(EXIT_FAILURE);
         }
Index: /trunk/ippdb/tests/insertobject.c
===================================================================
--- /trunk/ippdb/tests/insertobject.c	(revision 9186)
+++ /trunk/ippdb/tests/insertobject.c	(revision 9187)
@@ -300,5 +300,5 @@
         }
 
-        object = rawDetrendExpRowAlloc("a string", "a string", "a string", "a string", -32, "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64);
+        object = rawDetrendExpRowAlloc("a string", "a string", "a string", "a string", -32, "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");
         if (!object) {
             exit(EXIT_FAILURE);
@@ -322,5 +322,5 @@
         }
 
-        object = rawScienceExpRowAlloc("a string", "a string", "a string", "a string", -32, "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64);
+        object = rawScienceExpRowAlloc("a string", "a string", "a string", "a string", -32, "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");
         if (!object) {
             exit(EXIT_FAILURE);
@@ -344,5 +344,5 @@
         }
 
-        object = rawImfileRowAlloc("a string", "a string", "a string", "a string", "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);
+        object = rawImfileRowAlloc("a string", "a string", "a string", "a string", "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");
         if (!object) {
             exit(EXIT_FAILURE);
Index: /trunk/ippdb/tests/metadatafromobject.c
===================================================================
--- /trunk/ippdb/tests/metadatafromobject.c	(revision 9186)
+++ /trunk/ippdb/tests/metadatafromobject.c	(revision 9187)
@@ -602,5 +602,5 @@
         bool            status;
 
-        object = rawDetrendExpRowAlloc("a string", "a string", "a string", "a string", -32, "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64);
+        object = rawDetrendExpRowAlloc("a string", "a string", "a string", "a string", -32, "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");
         if (!object) {
             exit(EXIT_FAILURE);
@@ -682,4 +682,8 @@
             exit(EXIT_FAILURE);
         }
+        if (strncmp(psMetadataLookupPtr(&status, md, "obstype"), "a string", MAX_STRING_LENGTH)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
 
         psFree(md);
@@ -691,5 +695,5 @@
         bool            status;
 
-        object = rawScienceExpRowAlloc("a string", "a string", "a string", "a string", -32, "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64);
+        object = rawScienceExpRowAlloc("a string", "a string", "a string", "a string", -32, "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");
         if (!object) {
             exit(EXIT_FAILURE);
@@ -771,4 +775,8 @@
             exit(EXIT_FAILURE);
         }
+        if (strncmp(psMetadataLookupPtr(&status, md, "obstype"), "a string", MAX_STRING_LENGTH)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
 
         psFree(md);
@@ -780,5 +788,5 @@
         bool            status;
 
-        object = rawImfileRowAlloc("a string", "a string", "a string", "a string", "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);
+        object = rawImfileRowAlloc("a string", "a string", "a string", "a string", "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");
         if (!object) {
             exit(EXIT_FAILURE);
@@ -857,4 +865,8 @@
         }
         if (!psMetadataLookupF64(&status, md, "posang") == 64.64) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(psMetadataLookupPtr(&status, md, "obstype"), "a string", MAX_STRING_LENGTH)) {
             psFree(md);
             exit(EXIT_FAILURE);
Index: /trunk/ippdb/tests/objectfrommetadata.c
===================================================================
--- /trunk/ippdb/tests/objectfrommetadata.c	(revision 9186)
+++ /trunk/ippdb/tests/objectfrommetadata.c	(revision 9187)
@@ -947,4 +947,8 @@
             exit(EXIT_FAILURE);
         }
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "obstype", 0, NULL, "a string")) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
 
         object = rawDetrendExpObjectFromMetadata(md);
@@ -1024,4 +1028,8 @@
             exit(EXIT_FAILURE);
         }
+        if (strncmp(object->obstype, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
 
         psFree(object);
@@ -1101,4 +1109,8 @@
             exit(EXIT_FAILURE);
         }
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "obstype", 0, NULL, "a string")) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
 
         object = rawScienceExpObjectFromMetadata(md);
@@ -1178,4 +1190,8 @@
             exit(EXIT_FAILURE);
         }
+        if (strncmp(object->obstype, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
 
         psFree(object);
@@ -1255,4 +1271,8 @@
             exit(EXIT_FAILURE);
         }
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "obstype", 0, NULL, "a string")) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
 
         object = rawImfileObjectFromMetadata(md);
@@ -1329,4 +1349,8 @@
         }
         if (!object->posang == 64.64) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->obstype, "a string", MAX_STRING_LENGTH)) {
             psFree(object);
             exit(EXIT_FAILURE);
Index: /trunk/ippdb/tests/pop.c
===================================================================
--- /trunk/ippdb/tests/pop.c	(revision 9186)
+++ /trunk/ippdb/tests/pop.c	(revision 9187)
@@ -298,11 +298,12 @@
         psF32           ccd_temp;
         psF64           posang;
-
-        dbh = psDBInit("localhost", "test", NULL, "test");
-        if (!dbh) {
-            exit(EXIT_FAILURE);
-        }
-
-        if (!rawDetrendExpPop(dbh, (char **)&exp_tag, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, &airmass, &ra, &decl, &exp_time, &bg, &bg_stdev, &bg_mean_stdev, &alt, &az, &ccd_temp, &posang)) { 
+        char            obstype[256];
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!rawDetrendExpPop(dbh, (char **)&exp_tag, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, &airmass, &ra, &decl, &exp_time, &bg, &bg_stdev, &bg_mean_stdev, &alt, &az, &ccd_temp, &posang, (char **)&obstype)) { 
             exit(EXIT_FAILURE);
         }
@@ -330,11 +331,12 @@
         psF32           ccd_temp;
         psF64           posang;
-
-        dbh = psDBInit("localhost", "test", NULL, "test");
-        if (!dbh) {
-            exit(EXIT_FAILURE);
-        }
-
-        if (!rawScienceExpPop(dbh, (char **)&exp_tag, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, &airmass, &ra, &decl, &exp_time, &bg, &bg_stdev, &bg_mean_stdev, &alt, &az, &ccd_temp, &posang)) { 
+        char            obstype[256];
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!rawScienceExpPop(dbh, (char **)&exp_tag, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, &airmass, &ra, &decl, &exp_time, &bg, &bg_stdev, &bg_mean_stdev, &alt, &az, &ccd_temp, &posang, (char **)&obstype)) { 
             exit(EXIT_FAILURE);
         }
@@ -362,11 +364,12 @@
         psF32           ccd_temp;
         psF64           posang;
-
-        dbh = psDBInit("localhost", "test", NULL, "test");
-        if (!dbh) {
-            exit(EXIT_FAILURE);
-        }
-
-        if (!rawImfilePop(dbh, (char **)&exp_tag, (char **)&class, (char **)&class_id, (char **)&uri, (char **)&exp_type, (char **)&filter, &airmass, &ra, &decl, &exp_time, &bg, &bg_stdev, &bg_mean_stdev, &alt, &az, &ccd_temp, &posang)) { 
+        char            obstype[256];
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!rawImfilePop(dbh, (char **)&exp_tag, (char **)&class, (char **)&class_id, (char **)&uri, (char **)&exp_type, (char **)&filter, &airmass, &ra, &decl, &exp_time, &bg, &bg_stdev, &bg_mean_stdev, &alt, &az, &ccd_temp, &posang, (char **)&obstype)) { 
             exit(EXIT_FAILURE);
         }
