[Collab-qa-commits] r1638 - in udd: sql web/cgi-bin

Lucas Nussbaum lucas at alioth.debian.org
Sun Dec 13 23:03:29 UTC 2009


Author: lucas
Date: 2009-12-13 23:03:26 +0000 (Sun, 13 Dec 2009)
New Revision: 1638

Modified:
   udd/sql/setup.sql
   udd/web/cgi-bin/bapase.cgi
Log:
fix non-unique sources in Sources problems

Modified: udd/sql/setup.sql
===================================================================
--- udd/sql/setup.sql	2009-12-09 20:26:14 UTC (rev 1637)
+++ udd/sql/setup.sql	2009-12-13 23:03:26 UTC (rev 1638)
@@ -13,6 +13,29 @@
 
 GRANT SELECT ON sources TO PUBLIC;
 
+CREATE VIEW sources_uniq AS
+select * from sources s1
+where not exists (select * from sources s2
+where s1.source = s2.source
+and s1.distribution = s2.distribution
+and s1.release = s2.release
+and s1.component = s2.component
+and s2.version > s1.version);
+
+GRANT SELECT ON sources_uniq TO PUBLIC;
+
+CREATE VIEW sources_redundant AS
+select * from sources s1
+where exists (select * from sources s2
+where s1.source = s2.source
+and s1.distribution = s2.distribution
+and s1.release = s2.release
+and s1.component = s2.component
+and s2.version > s1.version);
+
+GRANT SELECT ON sources_redundant TO PUBLIC;
+
+
 -- no primary key possible: duplicate rows are possible because duplicate entries
 -- in Uploaders: are allowed. yes.
 CREATE TABLE uploaders (source text, version debversion, distribution text,
@@ -597,7 +620,7 @@
 uh.date as upload_date, (current_date - uh.date::date) as upload_age,
 nmu, coalesce(nmus, 0) as nmus, coalesce(rc_bugs,0) as rc_bugs, coalesce(all_bugs,0) as all_bugs,
 coalesce(insts,0) as insts, coalesce(vote,0) as vote
-from sources s
+from sources_uniq s
 left join orphaned_packages op on s.source = op.source
 left join migrations tm on s.source = tm.source
 left join  upload_history uh on s.source = uh.source and s.version = uh.version
@@ -614,6 +637,7 @@
 
 -- HISTORICAL DATA
 CREATE SCHEMA history;
+GRANT USAGE ON SCHEMA history TO public;
 CREATE TABLE history.sources_count (
   ts timestamp,
   total_sid_main int, total_sid_contrib int, total_sid_nonfree int,

Modified: udd/web/cgi-bin/bapase.cgi
===================================================================
--- udd/web/cgi-bin/bapase.cgi	2009-12-09 20:26:14 UTC (rev 1637)
+++ udd/web/cgi-bin/bapase.cgi	2009-12-13 23:03:26 UTC (rev 1638)
@@ -182,7 +182,7 @@
   select source from sources where distribution='debian' and release='squeeze' and maintainer_email in (
 select nmus.email from
 (select email, count(*) as tot from
-(select maintainer_email as email, source from sources
+(select maintainer_email as email, source from sources_uniq
 where release = 'sid'
 and distribution = 'debian'
 and component = 'main'
@@ -193,7 +193,7 @@
 and component = 'main') as foo
 group by email) as tot,
 (select email, count(*) as nmus from
-(select sources.maintainer_email as email, sources.source from sources, upload_history uh
+(select sources.maintainer_email as email, sources.source from sources_uniq sources, upload_history uh
 where release = 'sid'
 and distribution = 'debian'
 and component = 'main'
@@ -213,7 +213,7 @@
 union (select source from uploaders where distribution='debian' and release='squeeze' and email in (
 select nmus.email from
 (select email, count(*) as tot from
-(select maintainer_email as email, source from sources
+(select maintainer_email as email, source from sources_uniq sources
 where release = 'sid'
 and distribution = 'debian'
 and component = 'main'
@@ -224,7 +224,7 @@
 and component = 'main') as foo
 group by email) as tot,
 (select email, count(*) as nmus from
-(select sources.maintainer_email as email, sources.source from sources, upload_history uh
+(select sources.maintainer_email as email, sources.source from sources_uniq sources, upload_history uh
 where release = 'sid'
 and distribution = 'debian'
 and component = 'main'




More information about the Collab-qa-commits mailing list