Index: /trunk/ippToPsps/config/tables.DF.vot
===================================================================
--- /trunk/ippToPsps/config/tables.DF.vot	(revision 37585)
+++ /trunk/ippToPsps/config/tables.DF.vot	(revision 37586)
@@ -94,7 +94,4 @@
         <DESCRIPTION>ODM diff object identifier</DESCRIPTION>
       </FIELD>
-      <FIELD name="diffgcobjID" arraysize="1" datatype="long" unit="dimensionless" default="NA">
-        <DESCRIPTION>galactic coordinates ODM object identifier</DESCRIPTION>
-      </FIELD>
       <FIELD name="diffDetID" arraysize="1" datatype="long" unit="dimensionless" default="NA">
         <DESCRIPTION>ODM diff detection identifier</DESCRIPTION>
Index: /trunk/ippToPsps/config/tables.DO.vot
===================================================================
--- /trunk/ippToPsps/config/tables.DO.vot	(revision 37585)
+++ /trunk/ippToPsps/config/tables.DO.vot	(revision 37586)
@@ -11,7 +11,4 @@
       <FIELD name="diffObjID" arraysize="1" datatype="long" unit="dimensionless" default="NA">
         <DESCRIPTION>ODM object identifier index</DESCRIPTION>
-      </FIELD>
-      <FIELD name="diffgcobjID" arraysize="1" datatype="long" unit="dimensionless" default="NA">
-        <DESCRIPTION>galactic coordinates ODM object identifier</DESCRIPTION>
       </FIELD>
       <FIELD name="ippObjID" arraysize="1" datatype="long" unit="dimensionless" default="NA">
Index: /trunk/ippToPsps/config/tables.FO.vot
===================================================================
--- /trunk/ippToPsps/config/tables.FO.vot	(revision 37585)
+++ /trunk/ippToPsps/config/tables.FO.vot	(revision 37586)
@@ -12,7 +12,4 @@
 	<DESCRIPTION>unique psps id</DESCRIPTION>
       </FIELD>
-      <FIELD name="gcobjID" arraysize="1" datatype="long" unit="dimensionless" default="NA">
-        <DESCRIPTION>galactic coordinates ODM object identifier</DESCRIPTION>
-      </FIELD>
       <FIELD name="ippObjID" arraysize="1" datatype="long" unit="dimensionless" default="NA">
         <DESCRIPTION>IPP object number</DESCRIPTION>
Index: /trunk/ippToPsps/config/tables.FW.vot
===================================================================
--- /trunk/ippToPsps/config/tables.FW.vot	(revision 37585)
+++ /trunk/ippToPsps/config/tables.FW.vot	(revision 37586)
@@ -118,7 +118,4 @@
 	<DESCRIPTION>unique psps id</DESCRIPTION>
       </FIELD>
-      <FIELD name="gcobjID" arraysize="1" datatype="long" unit="dimensionless" default="NA">
-        <DESCRIPTION>galactic coordinates ODM object identifier</DESCRIPTION>
-      </FIELD>
       <FIELD name="detectID" arraysize="1" datatype="long" unit="dimensionless" default="NA">
         <DESCRIPTION>ODM  detection identifier</DESCRIPTION>
Index: /trunk/ippToPsps/config/tables.P2.vot
===================================================================
--- /trunk/ippToPsps/config/tables.P2.vot	(revision 37585)
+++ /trunk/ippToPsps/config/tables.P2.vot	(revision 37586)
@@ -383,5 +383,5 @@
         <DESCRIPTION>ODM object identifier</DESCRIPTION>
       </FIELD>
-      <FIELD name="unique_psps_ob_id" arraysize="1" datatype="long" unit="dimensionless" default="NA">
+      <FIELD name="unique_psps_p2_id" arraysize="1" datatype="long" unit="dimensionless" default="NA">
 	<DESCRIPTION>unique psps id</DESCRIPTION>
       </FIELD>
Index: /trunk/ippToPsps/jython/stackbatch.py
===================================================================
--- /trunk/ippToPsps/jython/stackbatch.py	(revision 37585)
+++ /trunk/ippToPsps/jython/stackbatch.py	(revision 37586)
@@ -293,4 +293,6 @@
         self.generateRandomIDs()
 
+        self.generateStackDetectRowIDs()
+
         # add indexes StackObjectThin
         self.scratchDb.createIndex("StackObjectThin", "objID")
@@ -382,5 +384,5 @@
         self.logger.infoPair("Procesing table", tablename)
         self.insertDvoIDs(tablename, "StackObjectThin")
-
+        
         # if we are going to add a key, do it here so it is useful
         self.scratchDb.createIndex(tablename, "objID") 
@@ -949,4 +951,14 @@
 
 
+    def generateStackDetectRowIDs(self):
+        sql = "UPDATE StackObjectThin join (select @r:=@r+1 rownum, objID from \
+        (select @r:=0) r, StackObjectThin t) as foo using (objID) set \
+        stackDetectRowID = ((" + str(self.batchID) + " << 32 ) + rownum)";
+        try: self.scratchDb.execute(sql)
+        except:
+            self.logger.errorPair('failed sql',sql)
+            return
+        
+
     '''
     select objID (psps object ID) from dvo restricted to this set of imageIDs. also insert
@@ -1008,5 +1020,7 @@
             if (i < len(self.filters) - 1):
                 fields += ", "
-        
+
+        if (table == "StackObjectAttributes"):
+            fields += "stackDetectRowID, "
         sql  = "INSERT INTO " + table + " (" + fields + ") "
         sql += "SELECT " + fields + " FROM " + mainTable
@@ -1016,5 +1030,7 @@
             self.logger.errorPair('failed sql',sql)
             return
-    
+
+
+        
     '''
     Does the processing, i.e. pulling stuff from IPP tables into PSPS tables
Index: /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/DiffDetObject
===================================================================
--- /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/DiffDetObject	(revision 37585)
+++ /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/DiffDetObject	(revision 37586)
@@ -3,5 +3,4 @@
 diffObjID	dimensionless 	BIGINT 	8 	NA 	ODM object identifier index
 unique_psps_do_id dimentionless BIGINT  8	NA	unique id provided by ipptopsps, based on batch_Id + counter
-diffgcObjID	dimensionless	BIGINT	8       NA 	ODM galactic coordinates identifier
 ippObjID  	dimensionless 	BIGINT 	8 	NA 	IPP object number
 surveyID 	dimensionless 	TINYINT 1 	255 	Survey ID
Index: /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/DiffDetObject.txt
===================================================================
--- /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/DiffDetObject.txt	(revision 37585)
+++ /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/DiffDetObject.txt	(revision 37586)
@@ -3,5 +3,4 @@
 diffObjID	 = dvo / addstar
 unique_psps_do_id = ipptopsps
-diffgcObjID	 = dvo / addstar
 ippObjID  	 = dvo / addstar
 surveyID 	 = ipptopsps
Index: /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/DiffDetection
===================================================================
--- /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/DiffDetection	(revision 37585)
+++ /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/DiffDetection	(revision 37586)
@@ -2,5 +2,4 @@
 diffObjID	dimensionless 	BIGINT 	8 	NA 	diff object identifier
 unique_psps_df_id dimensionless BIGINT  8	NA	unique psps id (combination of batch_id, and counter) provided by ipptopsps
-diffgcObjID	dimensionless	BIGINT	8	NA 	ODM galactic coordinates identifier
 diffDetID 	dimensionless 	BIGINT 	8 	NA 	diff detection identifier
 diffDetMetaID 	dimensionless 	BIGINT 	8 	NA 	diff detection meta identifier
Index: /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/DiffDetection.txt
===================================================================
--- /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/DiffDetection.txt	(revision 37585)
+++ /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/DiffDetection.txt	(revision 37586)
@@ -2,5 +2,4 @@
 diffObjID	 = dvo / addstar
 unique_psps_df_id = ipptopsps		 
-diffgcObjID	 = dvo / addstar
 diffDetID 	 = dvo / addstar
 diffDetMetaID 	 = dvo / addstar
Index: /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/ForcedMeanObject
===================================================================
--- /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/ForcedMeanObject	(revision 37585)
+++ /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/ForcedMeanObject	(revision 37586)
@@ -2,5 +2,4 @@
 objID           dimensionless   BIGINT   8        NA    ODM object identifier index
 unique_psps_fo_id dimensionless BIGINT   8	  NA 	unique id supplied by ipptopsps
-gcObjID		dimensionless	BIGINT	 8	  NA 	ODM galactic coordinates identifier
 ippObjID        dimensionless   BIGINT   8        NA    IPP object identifier
 nDetections     dimensionless   SMALLINT 2      -999    total number of detection measurements in all filters
Index: /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/ForcedMeanObject.txt
===================================================================
--- /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/ForcedMeanObject.txt	(revision 37585)
+++ /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/ForcedMeanObject.txt	(revision 37586)
@@ -2,5 +2,4 @@
 objID            = cpt.extID
 unique_psps_fo_id  = ipptopsps
-gcobjID          = remove?
 ippObjID         = cpt.objID | cpt.catID << 32
 nDetections      = sql sum of cps.NCODE (xnTotal)
Index: /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/ForcedWarpExtended
===================================================================
--- /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/ForcedWarpExtended	(revision 37585)
+++ /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/ForcedWarpExtended	(revision 37586)
@@ -2,5 +2,4 @@
 objID           dimensionless   BIGINT  8       NA      ODM object identifier
 unique_psps_fw_id dimentionless BIGINT  8	NA 	unique id supplied by ipptopsps
-gcObjID		dimensionless	BIGINT	8	NA 	ODM galactic coordinates identifier
 detectID        dimensionless   BIGINT  8       NA      ODM detection identifier
 ippObjID        dimensionless   BIGINT  8       NA      ippobject id generated by IPP
Index: /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/ForcedWarpExtended.txt
===================================================================
--- /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/ForcedWarpExtended.txt	(revision 37585)
+++ /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/ForcedWarpExtended.txt	(revision 37586)
@@ -2,5 +2,4 @@
 objID            = cpt.extID (???)
 unique_psps_fw_id = ipptopsps 
-gcObjID          = remove?
 detectID         = cpm.extID (???)
 ippObjID         = cpx.obj_ID | cpx.cat_ID << 32
Index: /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/ForcedWarpMeasurement
===================================================================
--- /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/ForcedWarpMeasurement	(revision 37585)
+++ /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/ForcedWarpMeasurement	(revision 37586)
@@ -2,5 +2,4 @@
 objID           dimensionless   BIGINT  8       NA      ODM object identifier
 unique_psps_fw_id dimensionless BIGINT  8 	NA	unique identifier provided by ipptopsps
-gcObjID		dimensionless	BIGINT	8	NA 	ODM galactic coordinates identifier
 detectID        dimensionless   BIGINT  8       NA      ODM detection identifier
 ippObjID        dimensionless   BIGINT  8       NA      ippobject id generated by IPP
Index: /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/ForcedWarpMeasurement.txt
===================================================================
--- /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/ForcedWarpMeasurement.txt	(revision 37585)
+++ /trunk/ippToPsps/pspsschema/SchemaNew19.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/ForcedWarpMeasurement.txt	(revision 37586)
@@ -2,5 +2,4 @@
 objID            = cpt.extID (???)
 unique_psps_fw_id = ipptopsps 
-gcObjID          = remove?
 detectID         = cpm.extID (???)
 ippObjID         = cpx.obj_id | cps.cat_id << 32
