]> git.donarmstrong.com Git - debbugs.git/blobdiff - Debbugs/DB/ResultSet/BugStatusCache.pm
paginate updatesqlcache properly and fix missing table alias
[debbugs.git] / Debbugs / DB / ResultSet / BugStatusCache.pm
index 264e0a917a47d9d5f15b176aca97ff85033752c7..18edf0c8df28188137af18c3de3b7493900eb131 100644 (file)
@@ -51,10 +51,12 @@ sub update_bug_status {
        dbh_do(sub {
                   my ($s,$dbh,$bug,$suite,$arch,$status,$modified,$asof) = @_;
                   select_one($dbh,<<'SQL',$bug,$suite,$arch,$status,$status);
-INSERT INTO bug_status_cache (bug,suite,arch,status,modified,asof)
+INSERT INTO bug_status_cache AS bsc
+(bug,suite,arch,status,modified,asof)
 VALUES (?,?,?,?,NOW(),NOW())
-ON CONFLICT (bug,suite,arch) DO 
-UPDATE SET asof=NOW(),modified=CASE WHEN status=? THEN modified ELSE NOW() END
+ON CONFLICT (bug,suite,arch) DO
+UPDATE
+ SET asof=NOW(),modified=CASE WHEN bsc.status=? THEN bsc.modified ELSE NOW() END
 RETURNING status;
 SQL
               },