-
+-- -*- mode: sql; sql-product: postgres; -*-
DROP TABLE bug_status_cache CASCADE;
DROP VIEW bug_package CASCADE;
DROP VIEW binary_versions CASCADE;
-- submitter would ideally be NOT NULL, but there are some ancient bugs which do not have submitters
submitter INT REFERENCES correspondent(id),
submitter_full TEXT NOT NULL DEFAULT '',
- unknown_packages TEXT NOT NULL DEfAULT ''
+ unknown_packages TEXT NOT NULL DEFAULT '',
+ unknown_affects TEXT NOT NULL DEFAULT ''
);
CREATE INDEX bug_idx_owner ON bug(owner);
CREATE INDEX bug_idx_submitter ON bug(submitter);
INSERT INTO column_comments VALUES ('bug','owner','Individual who owns this bug; empty if no one owns it');
INSERT INTO column_comments VALUES ('bug','submitter','Individual who submitted this bug; empty if there is no submitter');
INSERT INTO column_comments VALUES ('bug','unknown_packages','Package name if the package is not known');
+INSERT INTO column_comments VALUES ('bug','unknown_affects','Package name if the affected package is not known');
modified TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
asof TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL
);
-CREATE UNIQUE INDEX bug_status_cache_bug_suite_arch_idx ON bug_status_cache(bug,suite,arch);
+CREATE UNIQUE INDEX bug_status_cache_bug_suite_arch_idx ON
+ bug_status_cache(bug,suite,arch);
+CREATE UNIQUE INDEX bug_status_cache_bug_col_suite_col_arch_idx ON
+ bug_status_cache(bug,COALESCE(suite,0),COALESCE(arch,0));
CREATE INDEX bug_status_cache_idx_bug ON bug_status_cache(bug);
CREATE INDEX bug_status_cache_idx_status ON bug_status_cache(status);
CREATE INDEX bug_status_cache_idx_arch ON bug_status_cache(arch);
JOIN src_pkg sp ON bsp.src_pkg=sp.id
WHERE bsp.bug=b.id) AS package
) AS package,
+ (SELECT msgid FROM message m LEFT JOIN bug_message bm ON bm.message=m.id
+ WHERE bm.bug=b.id ORDER BY m.sent_date ASC limit 1) AS message_id,
b.submitter_full AS originator,
- b.log_modified AS log_modified,
- b.creation AS date,
- b.last_modified AS last_modified,
+ EXTRACT(EPOCH FROM b.log_modified) AS log_modified,
+ EXTRACT(EPOCH FROM b.creation) AS date,
+ EXTRACT(EPOCH FROM b.last_modified) AS last_modified,
+ b.done_full AS done,
string_agg(bb.blocks::text,' ' ORDER BY bb.blocks) AS blocks,
string_agg(bbb.bug::text,' ' ORDER BY bbb.bug) AS blockedby,
(SELECT string_agg(bug.bug::text,' ' ORDER BY bug.bug)
- FROM (SELECT b.id AS bug
- UNION
- SELECT bm.merged AS bug FROM bug_merged bm WHERE bm.bug=b.id
+ FROM (SELECT bm.merged AS bug FROM bug_merged bm WHERE bm.bug=b.id
UNION
- SELECT bm.bug AS bug FROM bug_merged bm WHERE bm.merged=b.id) AS bug) AS merged,
+ SELECT bm.bug AS bug FROM bug_merged bm WHERE bm.merged=b.id) AS bug) AS mergedwith,
(SELECT string_agg(bv.ver_string,' ') FROM bug_ver bv WHERE bv.bug=b.id AND bv.found IS TRUE)
AS found_versions,
- (SELECT string_agg(bv.ver_string,' ') FROM bug_ver bv WHERE bv.bug=b.id AND bv.found IS TRUE)
+ (SELECT string_agg(bv.ver_string,' ') FROM bug_ver bv WHERE bv.bug=b.id AND bv.found IS FALSE)
AS fixed_versions
FROM bug b
LEFT JOIN bug_tag bt ON bt.bug=b.id