]> pd.if.org Git - zpackage/blob - schema/syncconflicts.sql
remove stray debug fprintf
[zpackage] / schema / syncconflicts.sql
1 create view syncconflicts as
2 with 
3 -- metadata different
4 md_conflict as (
5         select path, count(distinct
6         printf('%s:%s:%s:%s', PFA.filetype, PFA.mode, PFA.username, PFA.groupname)) as mdcount,
7         count(distinct PFA.hash) as hashcount
8         from packagefiles PFA
9         join packages PA
10         on PA.package = PFA.package and PA.version = PFA.version and PA.release = PFA.release
11         where PA.status in ('installing', 'installed')
12         group by path
13         having (count(distinct printf('%s:%s:%s:%s', PFA.filetype, PFA.mode, PFA.username, PFA.groupname)
14         ) > 1 or count(distinct PFA.hash) > 1)
15 )
16 select PFH.*,
17         printf('%s-%s-%s', PFH.package, PFH.version, PFH.release) as pkgid,
18         printf('%s:%s:%s:%s', PFH.filetype, PFH.mode, PFH.username, PFH.groupname) as mds,
19 'hash' as conflict
20 from packagefiles PFH
21         join packages PA
22         on PA.package = PFH.package and PA.version = PFH.version and PA.release = PFH.release
23 where path in (select path from md_conflict where hashcount > 1)
24         and PA.status in ('installing', 'installed')
25 union
26 select PFM.*,
27         printf('%s-%s-%s', PFM.package, PFM.version, PFM.release) as pkgid,
28         printf('%s:%s:%s:%s', PFM.filetype, PFM.mode, PFM.username, PFM.groupname) as mds,
29 'md' as conflict
30 from packagefiles PFM
31         join packages PA
32         on PA.package = PFM.package and PA.version = PFM.version and PA.release = PFM.release
33 where path in (select path from md_conflict where hashcount > 1)
34         and PA.status in ('installing', 'installed')
35 ;