about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-06-08T13·38+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-06-08T13·38+0000
commitd1f6c0cbe39b509545f809f08cbd580859f38e34 (patch)
tree550edebce080a5cf2eb4fbaabe4f3b7b38ac93cb /src/libstore
parenta443c7573b3d76a6db107e6de974205e605a2738 (diff)
* Replacing ValidPath rows doesn't work because it causes a constraint
  violation of the Refs table.  So don't do that.

Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/local-store.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 071f8a2231bd..cf0d559bdfb9 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -311,7 +311,7 @@ void LocalStore::openDB(bool create)
 
     /* Prepare SQL statements. */
     stmtRegisterValidPath.create(db,
-        "insert or replace into ValidPaths (path, hash, registrationTime, deriver) values (?, ?, ?, ?);");
+        "insert into ValidPaths (path, hash, registrationTime, deriver) values (?, ?, ?, ?);");
     stmtAddReference.create(db,
         "insert or replace into Refs (referrer, reference) values (?, ?);");
     stmtQueryPathInfo.create(db,
@@ -837,7 +837,10 @@ void LocalStore::registerValidPaths(const ValidPathInfos & infos)
 {
     SQLiteTxn txn(db);
     
-    foreach (ValidPathInfos::const_iterator, i, infos) addValidPath(*i);
+    foreach (ValidPathInfos::const_iterator, i, infos)
+        /* !!! Maybe the registration info should be updated if the
+           path is already valid. */
+        if (!isValidPath(i->path)) addValidPath(*i);
 
     foreach (ValidPathInfos::const_iterator, i, infos) {
         unsigned long long referrer = queryValidPathId(i->path);