Index: DBRow.php
===================================================================
--- DBRow.php	(revision 14749)
+++ DBRow.php	(working copy)
@@ -151,7 +151,9 @@
 	 */
 	public function serialisePriKey()
 	{
-		
+		if (!$this->primaryKeyFilled()) {
+			return null;
+		}
 		$keys = array();
 		foreach($this->pri_keys as $field){
 			$keys[] = $this->{$field};
@@ -560,7 +562,10 @@
 			// If we know what the original pri key of this row was, check to
 			// see if it has changed: if so, we need to update the pri key
 			// columns too
-			if ($this->_orig_prikey !== null) {
+			// In the case it was empty reset it
+			if ($this->_orig_prikey === null) {
+				$this->_orig_prikey = $this->serialisePriKey();
+			} else {
 				if ($this->_orig_prikey != $this->serialisePriKey()) {
 					$fields_to_update = array_merge($fields_to_update, $this->pri_keys);
 				}
