/[BackupPC]/trunk/sql/fix_found_in_db.sql
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/sql/fix_found_in_db.sql

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 75 by dpavlin, Fri Aug 26 20:44:24 2005 UTC revision 76 by dpavlin, Fri Aug 26 21:18:37 2005 UTC
# Line 1  Line 1 
1  -- fix database to repair found_in_db bug fixed in r74  -- fix database to repair found_in_db bug fixed in r74
2    
3  delete from files where id not in (  --delete from files where id not in (
4          select distinct on(shareid,path,date,size) id  --      select distinct on(shareid,path,date,size) id
5          from files  --      from files
6          order by shareid,path,date,size,backupnum asc  --      order by shareid,path,date,size,backupnum asc
7  );  --);
8    
9    -- Below is alternative implementation which seems much faster for me.
10    -- You must manually COMMIT your transaction to make changes permanent.
11    
12    begin ;
13    select distinct on(shareid,path,date,size) id into temp okids from files order by shareid,path,date,size,backupnum asc;
14    delete from files where id not in (select id from okids) ;

Legend:
Removed from v.75  
changed lines
  Added in v.76

  ViewVC Help
Powered by ViewVC 1.1.26