23
72
free_percent double precision
76
SET search_path = ts2, pg_catalog;
78
CREATE DOMAIN gtsq AS text;
81
CREATE DOMAIN gtsvector AS pg_catalog.gtsvector;
84
CREATE TYPE statinfo AS (
91
CREATE TYPE tokenout AS (
97
CREATE TYPE tokentype AS (
104
CREATE TYPE tsdebug AS (
110
tsvector pg_catalog.tsvector
114
CREATE DOMAIN tsquery AS pg_catalog.tsquery;
117
CREATE DOMAIN tsvector AS pg_catalog.tsvector;
120
SET search_path = public, pg_catalog;
122
CREATE FUNCTION activity() RETURNS SETOF pg_stat_activity
123
LANGUAGE sql SECURITY DEFINER
124
SET search_path TO public
127
datid, datname, procpid, usesysid, usename,
129
WHEN current_query LIKE '<IDLE>%'
130
OR current_query LIKE 'autovacuum:%'
134
END AS current_query,
135
waiting, xact_start, query_start,
136
backend_start, client_addr, client_port
137
FROM pg_catalog.pg_stat_activity;
141
COMMENT ON FUNCTION activity() IS 'SECURITY DEFINER wrapper around pg_stat_activity allowing unprivileged users to access most of its information.';
144
CREATE FUNCTION add_test_openid_identifier(account_ integer) RETURNS boolean
145
LANGUAGE plpgsql SECURITY DEFINER
146
SET search_path TO public
149
-- The generated OpenIdIdentifier is not a valid OpenId Identity URL
150
-- and does not match tokens generated by the Canonical SSO. They
151
-- are only useful to the test suite, and access to this stored
152
-- procedure on production does not allow you to compromise
154
INSERT INTO OpenIdIdentifier (identifier, account)
155
VALUES ('test' || CAST(account_ AS text), account_);
158
WHEN unique_violation THEN
164
COMMENT ON FUNCTION add_test_openid_identifier(account_ integer) IS 'Add an OpenIdIdentifier to an account that can be used to login in the test environment. These identifiers are not usable on production or staging.';
167
CREATE FUNCTION assert_patch_applied(major integer, minor integer, patch integer) RETURNS boolean
168
LANGUAGE plpythonu STABLE
170
rv = plpy.execute("""
171
SELECT * FROM LaunchpadDatabaseRevision
172
WHERE major=%d AND minor=%d AND patch=%d
173
""" % (major, minor, patch))
176
'patch-%d-%02d-%d not applied.' % (major, minor, patch))
182
COMMENT ON FUNCTION assert_patch_applied(major integer, minor integer, patch integer) IS 'Raise an exception if the given database patch has not been applied.';
185
CREATE FUNCTION bug_maintain_bug_summary() RETURNS trigger
186
LANGUAGE plpgsql SECURITY DEFINER
187
SET search_path TO public
190
-- There is no INSERT logic, as a bug will not have any summary
191
-- information until BugTask rows have been attached.
192
IF TG_OP = 'UPDATE' THEN
193
IF OLD.duplicateof IS DISTINCT FROM NEW.duplicateof
194
OR OLD.private IS DISTINCT FROM NEW.private
195
OR (OLD.latest_patch_uploaded IS NULL)
196
<> (NEW.latest_patch_uploaded IS NULL) THEN
197
PERFORM unsummarise_bug(OLD);
198
PERFORM summarise_bug(NEW);
201
ELSIF TG_OP = 'DELETE' THEN
202
PERFORM unsummarise_bug(OLD);
205
PERFORM bug_summary_flush_temp_journal();
206
RETURN NULL; -- Ignored - this is an AFTER trigger
211
COMMENT ON FUNCTION bug_maintain_bug_summary() IS 'AFTER trigger on bug maintaining the bugs summaries in bugsummary.';
214
CREATE FUNCTION valid_bug_name(text) RETURNS boolean
215
LANGUAGE plpythonu IMMUTABLE STRICT
219
pat = r"^[a-z][a-z0-9+\.\-]+$"
220
if re.match(pat, name):
226
COMMENT ON FUNCTION valid_bug_name(text) IS 'validate a bug name
228
As per valid_name, except numeric-only names are not allowed (including
229
names that look like floats).';
26
232
SET default_tablespace = '';
28
234
SET default_with_oids = false;
30
CREATE TABLE revision (
32
date_created timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
33
log_body text NOT NULL,
34
revision_author integer NOT NULL,
36
revision_id text NOT NULL,
37
revision_date timestamp without time zone,
38
karma_allocated boolean DEFAULT false
40
ALTER TABLE ONLY revision ALTER COLUMN revision_author SET STATISTICS 500;
41
ALTER TABLE ONLY revision ALTER COLUMN revision_date SET STATISTICS 500;
238
datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
241
description text NOT NULL,
242
owner integer NOT NULL,
245
private boolean DEFAULT false NOT NULL,
246
security_related boolean DEFAULT false NOT NULL,
247
date_last_updated timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
248
date_made_private timestamp without time zone,
249
who_made_private integer,
250
date_last_message timestamp without time zone,
251
number_of_duplicates integer DEFAULT 0 NOT NULL,
252
message_count integer DEFAULT 0 NOT NULL,
253
users_affected_count integer DEFAULT 0,
254
users_unaffected_count integer DEFAULT 0,
255
heat integer DEFAULT 0 NOT NULL,
256
heat_last_updated timestamp without time zone,
257
latest_patch_uploaded timestamp without time zone,
258
access_policy integer,
259
CONSTRAINT notduplicateofself CHECK ((NOT (id = duplicateof))),
260
CONSTRAINT sane_description CHECK (((ltrim(description) <> ''::text) AND (char_length(description) <= 50000))),
261
CONSTRAINT valid_bug_name CHECK (valid_bug_name(name))
265
COMMENT ON TABLE bug IS 'A software bug that requires fixing. This particular bug may be linked to one or more products or source packages to identify the location(s) that this bug is found.';
268
COMMENT ON COLUMN bug.name IS 'A lowercase name uniquely identifying the bug';
271
COMMENT ON COLUMN bug.description IS 'A detailed description of the bug. Initially this will be set to the contents of the initial email or bug filing comment, but later it can be edited to give a more accurate description of the bug itself rather than the symptoms observed by the reporter.';
274
COMMENT ON COLUMN bug.private IS 'Is this bug private? If so, only explicit subscribers will be able to see it';
277
COMMENT ON COLUMN bug.security_related IS 'Is this bug a security issue?';
280
COMMENT ON COLUMN bug.date_last_message IS 'When the last BugMessage was attached to this Bug. Maintained by a trigger on the BugMessage table.';
283
COMMENT ON COLUMN bug.number_of_duplicates IS 'The number of bugs marked as duplicates of this bug, populated by a trigger after setting the duplicateof of bugs.';
286
COMMENT ON COLUMN bug.message_count IS 'The number of messages (currently just comments) on this bugbug, maintained by the set_bug_message_count_t trigger.';
289
COMMENT ON COLUMN bug.users_affected_count IS 'The number of users affected by this bug, maintained by the set_bug_users_affected_count_t trigger.';
292
COMMENT ON COLUMN bug.heat IS 'The relevance of this bug. This value is computed periodically using bug_affects_person and other bug values.';
295
COMMENT ON COLUMN bug.heat_last_updated IS 'The time this bug''s heat was last updated, or NULL if the heat has never yet been updated.';
298
COMMENT ON COLUMN bug.latest_patch_uploaded IS 'The time when the most recent patch has been attached to this bug or NULL if no patches are attached';
301
CREATE FUNCTION bug_row(bug_id integer) RETURNS bug
304
SELECT * FROM Bug WHERE id=$1;
308
COMMENT ON FUNCTION bug_row(bug_id integer) IS 'Helper for manually testing functions requiring a bug row as input. eg. SELECT * FROM bugsummary_tags(bug_row(1))';
311
CREATE TABLE bugsummary (
313
count integer DEFAULT 0 NOT NULL,
315
productseries integer,
316
distribution integer,
317
distroseries integer,
318
sourcepackagename integer,
321
status integer NOT NULL,
323
importance integer NOT NULL,
324
has_patch boolean NOT NULL,
325
fixed_upstream boolean NOT NULL,
326
CONSTRAINT bugtask_assignment_checks CHECK (CASE WHEN (product IS NOT NULL) THEN ((((productseries IS NULL) AND (distribution IS NULL)) AND (distroseries IS NULL)) AND (sourcepackagename IS NULL)) WHEN (productseries IS NOT NULL) THEN (((distribution IS NULL) AND (distroseries IS NULL)) AND (sourcepackagename IS NULL)) WHEN (distribution IS NOT NULL) THEN (distroseries IS NULL) WHEN (distroseries IS NOT NULL) THEN true ELSE false END)
330
CREATE FUNCTION bug_summary_dec(bugsummary) RETURNS void
333
-- We own the row reference, so in the absence of bugs this cannot
334
-- fail - just decrement the row.
335
UPDATE BugSummary SET count = count + $1.count
337
((product IS NULL AND $1.product IS NULL)
338
OR product = $1.product)
339
AND ((productseries IS NULL AND $1.productseries IS NULL)
340
OR productseries = $1.productseries)
341
AND ((distribution IS NULL AND $1.distribution IS NULL)
342
OR distribution = $1.distribution)
343
AND ((distroseries IS NULL AND $1.distroseries IS NULL)
344
OR distroseries = $1.distroseries)
345
AND ((sourcepackagename IS NULL AND $1.sourcepackagename IS NULL)
346
OR sourcepackagename = $1.sourcepackagename)
347
AND ((viewed_by IS NULL AND $1.viewed_by IS NULL)
348
OR viewed_by = $1.viewed_by)
349
AND ((tag IS NULL AND $1.tag IS NULL)
351
AND status = $1.status
352
AND ((milestone IS NULL AND $1.milestone IS NULL)
353
OR milestone = $1.milestone)
354
AND importance = $1.importance
355
AND has_patch = $1.has_patch
356
AND fixed_upstream = $1.fixed_upstream;
360
COMMENT ON FUNCTION bug_summary_dec(bugsummary) IS 'UPSERT into bugsummary incrementing one row';
363
CREATE FUNCTION bug_summary_flush_temp_journal() RETURNS void
367
d bugsummary%ROWTYPE;
369
-- may get called even though no summaries were made (for simplicity in the
371
PERFORM ensure_bugsummary_temp_journal();
372
FOR d IN SELECT * FROM bugsummary_temp_journal LOOP
373
PERFORM bugsummary_journal_ins(d);
375
TRUNCATE bugsummary_temp_journal;
380
COMMENT ON FUNCTION bug_summary_flush_temp_journal() IS 'flush the temporary bugsummary journal into the bugsummary table';
383
CREATE FUNCTION bug_summary_inc(d bugsummary) RETURNS void
387
-- Shameless adaption from postgresql manual
389
-- first try to update the row
390
UPDATE BugSummary SET count = count + d.count
392
((product IS NULL AND $1.product IS NULL)
393
OR product = $1.product)
394
AND ((productseries IS NULL AND $1.productseries IS NULL)
395
OR productseries = $1.productseries)
396
AND ((distribution IS NULL AND $1.distribution IS NULL)
397
OR distribution = $1.distribution)
398
AND ((distroseries IS NULL AND $1.distroseries IS NULL)
399
OR distroseries = $1.distroseries)
400
AND ((sourcepackagename IS NULL AND $1.sourcepackagename IS NULL)
401
OR sourcepackagename = $1.sourcepackagename)
402
AND ((viewed_by IS NULL AND $1.viewed_by IS NULL)
403
OR viewed_by = $1.viewed_by)
404
AND ((tag IS NULL AND $1.tag IS NULL)
406
AND status = $1.status
407
AND ((milestone IS NULL AND $1.milestone IS NULL)
408
OR milestone = $1.milestone)
409
AND importance = $1.importance
410
AND has_patch = $1.has_patch
411
AND fixed_upstream = $1.fixed_upstream;
415
-- not there, so try to insert the key
416
-- if someone else inserts the same key concurrently,
417
-- we could get a unique-key failure
419
INSERT INTO BugSummary(
420
count, product, productseries, distribution,
421
distroseries, sourcepackagename, viewed_by, tag,
423
importance, has_patch, fixed_upstream)
425
d.count, d.product, d.productseries, d.distribution,
426
d.distroseries, d.sourcepackagename, d.viewed_by, d.tag,
427
d.status, d.milestone,
428
d.importance, d.has_patch, d.fixed_upstream);
430
EXCEPTION WHEN unique_violation THEN
431
-- do nothing, and loop to try the UPDATE again
438
COMMENT ON FUNCTION bug_summary_inc(d bugsummary) IS 'UPSERT into bugsummary incrementing one row';
441
CREATE FUNCTION bug_summary_temp_journal_ins(d bugsummary) RETURNS void
445
INSERT INTO BugSummary_Temp_Journal(
446
count, product, productseries, distribution,
447
distroseries, sourcepackagename, viewed_by, tag,
448
status, milestone, importance, has_patch, fixed_upstream)
450
d.count, d.product, d.productseries, d.distribution,
451
d.distroseries, d.sourcepackagename, d.viewed_by, d.tag,
452
d.status, d.milestone, d.importance, d.has_patch, d.fixed_upstream);
458
COMMENT ON FUNCTION bug_summary_temp_journal_ins(d bugsummary) IS 'Insert a BugSummary into the temporary journal';
461
CREATE FUNCTION bug_update_heat_copy_to_bugtask() RETURNS trigger
462
LANGUAGE plpgsql SECURITY DEFINER
463
SET search_path TO public
466
IF NEW.heat != OLD.heat THEN
467
UPDATE bugtask SET heat=NEW.heat WHERE bugtask.bug=NEW.id;
469
RETURN NULL; -- Ignored - this is an AFTER trigger
474
COMMENT ON FUNCTION bug_update_heat_copy_to_bugtask() IS 'Copies bug heat to bugtasks when the bug is changed. Runs on UPDATE only because INSERTs do not have bugtasks at the point of insertion.';
477
CREATE FUNCTION bug_update_latest_patch_uploaded(integer) RETURNS void
478
LANGUAGE plpgsql SECURITY DEFINER
479
SET search_path TO public
482
UPDATE bug SET latest_patch_uploaded =
483
(SELECT max(message.datecreated)
484
FROM message, bugattachment
485
WHERE bugattachment.message=message.id AND
486
bugattachment.bug=$1 AND
487
bugattachment.type=1)
493
CREATE FUNCTION bug_update_latest_patch_uploaded_on_delete() RETURNS trigger
494
LANGUAGE plpgsql SECURITY DEFINER
495
SET search_path TO public
498
PERFORM bug_update_latest_patch_uploaded(OLD.bug);
499
RETURN NULL; -- Ignored - this is an AFTER trigger
504
CREATE FUNCTION bug_update_latest_patch_uploaded_on_insert_update() RETURNS trigger
505
LANGUAGE plpgsql SECURITY DEFINER
506
SET search_path TO public
509
PERFORM bug_update_latest_patch_uploaded(NEW.bug);
510
RETURN NULL; -- Ignored - this is an AFTER trigger
515
CREATE FUNCTION bugmessage_copy_owner_from_message() RETURNS trigger
516
LANGUAGE plpgsql SECURITY DEFINER
517
SET search_path TO public
520
IF TG_OP = 'INSERT' THEN
521
IF NEW.owner is NULL THEN
523
SET owner = Message.owner FROM
525
Message.id = NEW.message AND
526
BugMessage.id = NEW.id;
528
ELSIF NEW.message != OLD.message THEN
530
SET owner = Message.owner FROM
532
Message.id = NEW.message AND
533
BugMessage.id = NEW.id;
535
RETURN NULL; -- Ignored - this is an AFTER trigger
540
COMMENT ON FUNCTION bugmessage_copy_owner_from_message() IS 'Copies the message owner into bugmessage when bugmessage changes.';
543
CREATE FUNCTION bugsubscription_maintain_bug_summary() RETURNS trigger
544
LANGUAGE plpgsql SECURITY DEFINER
545
SET search_path TO public
548
-- This trigger only works if we are inserting, updating or deleting
549
-- a single row per statement.
550
IF TG_OP = 'INSERT' THEN
551
IF NOT (bug_row(NEW.bug)).private THEN
552
-- Public subscriptions are not aggregated.
555
IF TG_WHEN = 'BEFORE' THEN
556
PERFORM unsummarise_bug(bug_row(NEW.bug));
558
PERFORM summarise_bug(bug_row(NEW.bug));
560
PERFORM bug_summary_flush_temp_journal();
562
ELSIF TG_OP = 'DELETE' THEN
563
IF NOT (bug_row(OLD.bug)).private THEN
564
-- Public subscriptions are not aggregated.
567
IF TG_WHEN = 'BEFORE' THEN
568
PERFORM unsummarise_bug(bug_row(OLD.bug));
570
PERFORM summarise_bug(bug_row(OLD.bug));
572
PERFORM bug_summary_flush_temp_journal();
575
IF (OLD.person IS DISTINCT FROM NEW.person
576
OR OLD.bug IS DISTINCT FROM NEW.bug) THEN
577
IF TG_WHEN = 'BEFORE' THEN
578
IF (bug_row(OLD.bug)).private THEN
579
-- Public subscriptions are not aggregated.
580
PERFORM unsummarise_bug(bug_row(OLD.bug));
582
IF OLD.bug <> NEW.bug AND (bug_row(NEW.bug)).private THEN
583
-- Public subscriptions are not aggregated.
584
PERFORM unsummarise_bug(bug_row(NEW.bug));
587
IF (bug_row(OLD.bug)).private THEN
588
-- Public subscriptions are not aggregated.
589
PERFORM summarise_bug(bug_row(OLD.bug));
591
IF OLD.bug <> NEW.bug AND (bug_row(NEW.bug)).private THEN
592
-- Public subscriptions are not aggregated.
593
PERFORM summarise_bug(bug_row(NEW.bug));
597
PERFORM bug_summary_flush_temp_journal();
604
COMMENT ON FUNCTION bugsubscription_maintain_bug_summary() IS 'AFTER trigger on bugsubscription maintaining the bugs summaries in bugsummary.';
607
CREATE FUNCTION bugsummary_journal_ins(d bugsummary) RETURNS void
612
INSERT INTO BugSummaryJournal (
613
count, product, productseries, distribution,
614
distroseries, sourcepackagename, viewed_by, tag,
616
importance, has_patch, fixed_upstream)
618
d.count, d.product, d.productseries, d.distribution,
619
d.distroseries, d.sourcepackagename, d.viewed_by, d.tag,
620
d.status, d.milestone,
621
d.importance, d.has_patch, d.fixed_upstream);
627
COMMENT ON FUNCTION bugsummary_journal_ins(d bugsummary) IS 'Add an entry into BugSummaryJournal';
630
CREATE FUNCTION bugsummary_locations(bug_row bug) RETURNS SETOF bugsummary
634
IF BUG_ROW.duplicateof IS NOT NULL THEN
639
CAST(NULL AS integer) AS id,
640
CAST(1 AS integer) AS count,
641
product, productseries, distribution, distroseries,
642
sourcepackagename, person AS viewed_by, tag, status, milestone,
644
BUG_ROW.latest_patch_uploaded IS NOT NULL AS has_patch,
646
SELECT TRUE FROM BugTask AS RBT
649
-- This would just be 'RBT.id <> tasks.id', except
650
-- that the records from tasks are summaries and not
651
-- real bugtasks, and do not have an id.
652
AND (RBT.product IS DISTINCT FROM tasks.product
654
IS DISTINCT FROM tasks.productseries
655
OR RBT.distribution IS DISTINCT FROM tasks.distribution
656
OR RBT.distroseries IS DISTINCT FROM tasks.distroseries
657
OR RBT.sourcepackagename
658
IS DISTINCT FROM tasks.sourcepackagename)
659
-- Flagged as INVALID, FIXCOMMITTED or FIXRELEASED
660
-- via a bugwatch, or FIXCOMMITTED or FIXRELEASED on
662
AND ((bugwatch IS NOT NULL AND status IN (17, 25, 30))
663
OR (bugwatch IS NULL AND product IS NOT NULL
664
AND status IN (25, 30))))
665
)::boolean AS fixed_upstream
666
FROM bugsummary_tasks(BUG_ROW) AS tasks
667
JOIN bugsummary_tags(BUG_ROW) AS bug_tags ON TRUE
668
LEFT OUTER JOIN bugsummary_viewers(BUG_ROW) AS bug_viewers ON TRUE;
673
COMMENT ON FUNCTION bugsummary_locations(bug_row bug) IS 'Calculate what BugSummary rows should exist for a given Bug.';
676
CREATE FUNCTION bugsummary_rollup_journal(batchsize integer DEFAULT NULL::integer) RETURNS void
677
LANGUAGE plpgsql SECURITY DEFINER
678
SET search_path TO public
681
d bugsummary%ROWTYPE;
684
-- Lock so we don't content with other invokations of this
685
-- function. We can happily lock the BugSummary table for writes
686
-- as this function is the only thing that updates that table.
687
-- BugSummaryJournal remains unlocked so nothing should be blocked.
688
LOCK TABLE BugSummary IN ROW EXCLUSIVE MODE;
690
IF batchsize IS NULL THEN
691
SELECT MAX(id) INTO max_id FROM BugSummaryJournal;
693
SELECT MAX(id) INTO max_id FROM (
694
SELECT id FROM BugSummaryJournal ORDER BY id LIMIT batchsize
714
FROM BugSummaryJournal
717
product, productseries, distribution, distroseries,
718
sourcepackagename, viewed_by, tag, status, milestone,
719
importance, has_patch, fixed_upstream
720
HAVING sum(count) <> 0
723
PERFORM bug_summary_dec(d);
724
ELSIF d.count > 0 THEN
725
PERFORM bug_summary_inc(d);
729
-- Clean out any counts we reduced to 0.
730
DELETE FROM BugSummary WHERE count=0;
731
-- Clean out the journal entries we have handled.
732
DELETE FROM BugSummaryJournal WHERE id <= max_id;
737
COMMENT ON FUNCTION bugsummary_rollup_journal(batchsize integer) IS 'Collate and migrate rows from BugSummaryJournal to BugSummary';
740
CREATE FUNCTION valid_name(text) RETURNS boolean
741
LANGUAGE plpythonu IMMUTABLE STRICT
745
pat = r"^[a-z0-9][a-z0-9\+\.\-]*\Z"
746
if re.match(pat, name):
752
COMMENT ON FUNCTION valid_name(text) IS 'validate a name.
754
Names must contain only lowercase letters, numbers, ., & -. They
755
must start with an alphanumeric. They are ASCII only. Names are useful
756
for mneumonic identifiers such as nicknames and as URL components.
757
This specification is the same as the Debian product naming policy.
759
Note that a valid name might be all integers, so there is a possible
760
namespace conflict if URL traversal is possible by name as well as id.';
763
CREATE TABLE bugtag (
765
bug integer NOT NULL,
767
CONSTRAINT valid_tag CHECK (valid_name(tag))
771
COMMENT ON TABLE bugtag IS 'Attaches simple text tags to a bug.';
774
COMMENT ON COLUMN bugtag.bug IS 'The bug the tags is attached to.';
777
COMMENT ON COLUMN bugtag.tag IS 'The text representation of the tag.';
780
CREATE FUNCTION bugsummary_tags(bug_row bug) RETURNS SETOF bugtag
783
SELECT * FROM BugTag WHERE BugTag.bug = $1.id
785
SELECT NULL::integer, $1.id, NULL::text;
789
COMMENT ON FUNCTION bugsummary_tags(bug_row bug) IS 'Return (bug, tag) for all tags + (bug, NULL::text)';
792
CREATE TABLE bugtask (
794
bug integer NOT NULL,
796
distribution integer,
797
distroseries integer,
798
sourcepackagename integer,
799
binarypackagename integer,
800
status integer NOT NULL,
801
importance integer DEFAULT 5 NOT NULL,
803
date_assigned timestamp without time zone,
804
datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone),
805
owner integer NOT NULL,
809
targetnamecache text,
810
date_confirmed timestamp without time zone,
811
date_inprogress timestamp without time zone,
812
date_closed timestamp without time zone,
813
productseries integer,
814
date_incomplete timestamp without time zone,
815
date_left_new timestamp without time zone,
816
date_triaged timestamp without time zone,
817
date_fix_committed timestamp without time zone,
818
date_fix_released timestamp without time zone,
819
date_left_closed timestamp without time zone,
820
heat_rank integer DEFAULT 0 NOT NULL,
821
date_milestone_set timestamp without time zone,
822
heat integer DEFAULT 0 NOT NULL,
823
CONSTRAINT bugtask_assignment_checks CHECK (CASE WHEN (product IS NOT NULL) THEN ((((productseries IS NULL) AND (distribution IS NULL)) AND (distroseries IS NULL)) AND (sourcepackagename IS NULL)) WHEN (productseries IS NOT NULL) THEN (((distribution IS NULL) AND (distroseries IS NULL)) AND (sourcepackagename IS NULL)) WHEN (distribution IS NOT NULL) THEN (distroseries IS NULL) WHEN (distroseries IS NOT NULL) THEN true ELSE false END)
827
COMMENT ON TABLE bugtask IS 'Links a given Bug to a particular (sourcepackagename, distro) or product.';
830
COMMENT ON COLUMN bugtask.bug IS 'The bug that is assigned to this (sourcepackagename, distro) or product.';
833
COMMENT ON COLUMN bugtask.product IS 'The product in which this bug shows up.';
836
COMMENT ON COLUMN bugtask.distribution IS 'The distro of the named sourcepackage.';
839
COMMENT ON COLUMN bugtask.sourcepackagename IS 'The name of the sourcepackage in which this bug shows up.';
842
COMMENT ON COLUMN bugtask.binarypackagename IS 'The name of the binary package built from the source package. This column may only contain a value if this bug task is linked to a sourcepackage (not a product)';
845
COMMENT ON COLUMN bugtask.status IS 'The general health of the bug, e.g. Accepted, Rejected, etc.';
848
COMMENT ON COLUMN bugtask.importance IS 'The importance of fixing the bug.';
851
COMMENT ON COLUMN bugtask.assignee IS 'The person who has been assigned to fix this bug in this product or (sourcepackagename, distro)';
854
COMMENT ON COLUMN bugtask.date_assigned IS 'The date on which the bug in this (sourcepackagename, distro) or product was assigned to someone to fix';
857
COMMENT ON COLUMN bugtask.datecreated IS 'A timestamp for the creation of this bug assignment. Note that this is not the date the bug was created (though it might be), it''s the date the bug was assigned to this product, which could have come later.';
860
COMMENT ON COLUMN bugtask.milestone IS 'A way to mark a bug for grouping purposes, e.g. to say it needs to be fixed by version 1.2';
863
COMMENT ON COLUMN bugtask.bugwatch IS 'This column allows us to link a bug
864
task to a bug watch. In other words, we are connecting the state of the task
865
to the state of the bug in a different bug tracking system. To the best of
866
our ability we''ll try and keep the bug task syncronised with the state of
867
the remote bug watch.';
870
COMMENT ON COLUMN bugtask.targetnamecache IS 'A cached value of the target name of this bugtask, to make it easier to sort and search on the target name.';
873
COMMENT ON COLUMN bugtask.date_confirmed IS 'The date when this bug transitioned from an unconfirmed status to a confirmed one. If the state regresses to a one that logically occurs before Confirmed, e.g., Unconfirmed, this date is cleared.';
876
COMMENT ON COLUMN bugtask.date_inprogress IS 'The date on which this bug transitioned from not being in progress to a state >= In Progress. If the status moves back to a pre-In Progress state, this date is cleared';
879
COMMENT ON COLUMN bugtask.date_closed IS 'The date when this bug transitioned to a resolved state, e.g., Rejected, Fix Released, etc. If the state changes back to a pre-closed state, this date is cleared';
882
COMMENT ON COLUMN bugtask.productseries IS 'The product series to which the bug is targeted';
885
COMMENT ON COLUMN bugtask.date_left_new IS 'The date when this bug first transitioned out of the NEW status.';
888
COMMENT ON COLUMN bugtask.date_triaged IS 'The date when this bug transitioned to a status >= TRIAGED.';
891
COMMENT ON COLUMN bugtask.date_fix_committed IS 'The date when this bug transitioned to a status >= FIXCOMMITTED.';
894
COMMENT ON COLUMN bugtask.date_fix_released IS 'The date when this bug transitioned to a FIXRELEASED status.';
897
COMMENT ON COLUMN bugtask.date_left_closed IS 'The date when this bug last transitioned out of a CLOSED status.';
900
COMMENT ON COLUMN bugtask.heat_rank IS 'The heat bin in which this bugtask appears, as a value from the BugTaskHeatRank enumeration.';
903
COMMENT ON COLUMN bugtask.date_milestone_set IS 'The date when this bug was targed to the milestone that is currently set.';
906
CREATE FUNCTION bugsummary_tasks(bug_row bug) RETURNS SETOF bugtask
907
LANGUAGE plpgsql STABLE
915
-- One row only for each target permutation - need to ignore other fields
916
-- like date last modified to deal with conjoined masters and multiple
917
-- sourcepackage tasks in a distro.
920
product, productseries, distribution, distroseries,
921
sourcepackagename, status, milestone, importance, bugwatch
922
FROM BugTask WHERE bug=BUG_ROW.id
923
UNION -- Implicit DISTINCT
925
product, productseries, distribution, distroseries,
926
NULL, status, milestone, importance, bugwatch
927
FROM BugTask WHERE bug=BUG_ROW.id AND sourcepackagename IS NOT NULL
929
bt.product = r.product;
930
bt.productseries = r.productseries;
931
bt.distribution = r.distribution;
932
bt.distroseries = r.distroseries;
933
bt.sourcepackagename = r.sourcepackagename;
934
bt.status = r.status;
935
bt.milestone = r.milestone;
936
bt.importance = r.importance;
937
bt.bugwatch = r.bugwatch;
944
COMMENT ON FUNCTION bugsummary_tasks(bug_row bug) IS 'Return all tasks for the bug + all sourcepackagename tasks again with the sourcepackagename squashed';
947
CREATE TABLE bugsubscription (
949
person integer NOT NULL,
950
bug integer NOT NULL,
951
date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
952
subscribed_by integer NOT NULL,
953
bug_notification_level integer DEFAULT 40 NOT NULL
957
COMMENT ON TABLE bugsubscription IS 'A subscription by a Person to a bug.';
960
COMMENT ON COLUMN bugsubscription.bug_notification_level IS 'The level of notifications which the Person will receive from this subscription.';
963
CREATE FUNCTION bugsummary_viewers(bug_row bug) RETURNS SETOF bugsubscription
969
bugsubscription.bug=$1.id
970
AND $1.private IS TRUE;
974
COMMENT ON FUNCTION bugsummary_viewers(bug_row bug) IS 'Return (bug, viewer) for all viewers if private, nothing otherwise';
977
CREATE FUNCTION bugtag_maintain_bug_summary() RETURNS trigger
978
LANGUAGE plpgsql SECURITY DEFINER
979
SET search_path TO public
982
IF TG_OP = 'INSERT' THEN
983
IF TG_WHEN = 'BEFORE' THEN
984
PERFORM unsummarise_bug(bug_row(NEW.bug));
986
PERFORM summarise_bug(bug_row(NEW.bug));
988
PERFORM bug_summary_flush_temp_journal();
990
ELSIF TG_OP = 'DELETE' THEN
991
IF TG_WHEN = 'BEFORE' THEN
992
PERFORM unsummarise_bug(bug_row(OLD.bug));
994
PERFORM summarise_bug(bug_row(OLD.bug));
996
PERFORM bug_summary_flush_temp_journal();
999
IF TG_WHEN = 'BEFORE' THEN
1000
PERFORM unsummarise_bug(bug_row(OLD.bug));
1001
IF OLD.bug <> NEW.bug THEN
1002
PERFORM unsummarise_bug(bug_row(NEW.bug));
1005
PERFORM summarise_bug(bug_row(OLD.bug));
1006
IF OLD.bug <> NEW.bug THEN
1007
PERFORM summarise_bug(bug_row(NEW.bug));
1010
PERFORM bug_summary_flush_temp_journal();
1017
COMMENT ON FUNCTION bugtag_maintain_bug_summary() IS 'AFTER trigger on bugtag maintaining the bugs summaries in bugsummary.';
1020
CREATE FUNCTION bugtask_maintain_bug_summary() RETURNS trigger
1021
LANGUAGE plpgsql SECURITY DEFINER
1022
SET search_path TO public
1025
-- This trigger only works if we are inserting, updating or deleting
1026
-- a single row per statement.
1028
-- Unlike bug_maintain_bug_summary, this trigger does not have access
1029
-- to the old bug when invoked as an AFTER trigger. To work around this
1030
-- we install this trigger as both a BEFORE and an AFTER trigger.
1031
IF TG_OP = 'INSERT' THEN
1032
IF TG_WHEN = 'BEFORE' THEN
1033
PERFORM unsummarise_bug(bug_row(NEW.bug));
1035
PERFORM summarise_bug(bug_row(NEW.bug));
1037
PERFORM bug_summary_flush_temp_journal();
1040
ELSIF TG_OP = 'DELETE' THEN
1041
IF TG_WHEN = 'BEFORE' THEN
1042
PERFORM unsummarise_bug(bug_row(OLD.bug));
1044
PERFORM summarise_bug(bug_row(OLD.bug));
1046
PERFORM bug_summary_flush_temp_journal();
1050
IF (OLD.product IS DISTINCT FROM NEW.product
1051
OR OLD.productseries IS DISTINCT FROM NEW.productseries
1052
OR OLD.distribution IS DISTINCT FROM NEW.distribution
1053
OR OLD.distroseries IS DISTINCT FROM NEW.distroseries
1054
OR OLD.sourcepackagename IS DISTINCT FROM NEW.sourcepackagename
1055
OR OLD.status IS DISTINCT FROM NEW.status
1056
OR OLD.importance IS DISTINCT FROM NEW.importance
1057
OR OLD.bugwatch IS DISTINCT FROM NEW.bugwatch
1058
OR OLD.milestone IS DISTINCT FROM NEW.milestone) THEN
1060
IF TG_WHEN = 'BEFORE' THEN
1061
PERFORM unsummarise_bug(bug_row(OLD.bug));
1062
IF OLD.bug <> NEW.bug THEN
1063
PERFORM unsummarise_bug(bug_row(NEW.bug));
1066
PERFORM summarise_bug(bug_row(OLD.bug));
1067
IF OLD.bug <> NEW.bug THEN
1068
PERFORM summarise_bug(bug_row(NEW.bug));
1072
PERFORM bug_summary_flush_temp_journal();
1079
COMMENT ON FUNCTION bugtask_maintain_bug_summary() IS 'Both BEFORE & AFTER trigger on bugtask maintaining the bugs summaries in bugsummary.';
1082
CREATE FUNCTION calculate_bug_heat(bug_id integer) RETURNS integer
1083
LANGUAGE plpythonu STABLE STRICT
1085
from datetime import datetime
1087
class BugHeatConstants:
1094
def get_max_heat_for_bug(bug_id):
1095
results = plpy.execute("""
1097
GREATEST(Product.max_bug_heat,
1098
DistributionSourcePackage.max_bug_heat))
1101
LEFT OUTER JOIN ProductSeries ON
1102
BugTask.productseries = ProductSeries.id
1103
LEFT OUTER JOIN Product ON (
1104
BugTask.product = Product.id
1105
OR ProductSeries.product = Product.id)
1106
LEFT OUTER JOIN DistroSeries ON
1107
BugTask.distroseries = DistroSeries.id
1108
LEFT OUTER JOIN Distribution ON (
1109
BugTask.distribution = Distribution.id
1110
OR DistroSeries.distribution = Distribution.id)
1111
LEFT OUTER JOIN DistributionSourcePackage ON (
1112
BugTask.sourcepackagename =
1113
DistributionSourcePackage.sourcepackagename)
1115
BugTask.bug = %s""" % bug_id)
1117
return results[0]['max_heat']
1119
# It would be nice to be able to just SELECT * here, but we need the
1120
# timestamps to be in a format that datetime.fromtimestamp() will
1122
bug_data = plpy.execute("""
1127
number_of_duplicates,
1128
users_affected_count,
1129
EXTRACT(epoch from datecreated)
1130
AS timestamp_date_created,
1131
EXTRACT(epoch from date_last_updated)
1132
AS timestamp_date_last_updated,
1133
EXTRACT(epoch from date_last_message)
1134
AS timestamp_date_last_message
1135
FROM Bug WHERE id = %s""" % bug_id)
1137
if bug_data.nrows() == 0:
1138
raise Exception("Bug %s doesn't exist." % bug_id)
1141
if bug['duplicateof'] is not None:
1146
BugHeatConstants.DUPLICATE * bug['number_of_duplicates'])
1147
heat['affected_users'] = (
1148
BugHeatConstants.AFFECTED_USER *
1149
bug['users_affected_count'])
1152
heat['privacy'] = BugHeatConstants.PRIVACY
1153
if bug['security_related']:
1154
heat['security'] = BugHeatConstants.SECURITY
1156
# Get the heat from subscribers, both direct and via duplicates.
1157
subs_from_dupes = plpy.execute("""
1158
SELECT COUNT(DISTINCT BugSubscription.person) AS sub_count
1159
FROM BugSubscription, Bug
1160
WHERE Bug.id = BugSubscription.bug
1161
AND (Bug.id = %s OR Bug.duplicateof = %s)"""
1164
heat['subcribers'] = (
1165
BugHeatConstants.SUBSCRIBER
1166
* subs_from_dupes[0]['sub_count'])
1168
total_heat = sum(heat.values())
1170
# Bugs decay over time. Every day the bug isn't touched its heat
1172
date_last_updated = datetime.fromtimestamp(
1173
bug['timestamp_date_last_updated'])
1174
days_since_last_update = (datetime.utcnow() - date_last_updated).days
1175
total_heat = int(total_heat * (0.99 ** days_since_last_update))
1177
if days_since_last_update > 0:
1178
# Bug heat increases by a quarter of the maximum bug heat
1179
# divided by the number of days since the bug's creation date.
1180
date_created = datetime.fromtimestamp(
1181
bug['timestamp_date_created'])
1183
if bug['timestamp_date_last_message'] is not None:
1184
date_last_message = datetime.fromtimestamp(
1185
bug['timestamp_date_last_message'])
1186
oldest_date = max(date_last_updated, date_last_message)
1188
date_last_message = None
1189
oldest_date = date_last_updated
1191
days_since_last_activity = (datetime.utcnow() - oldest_date).days
1192
days_since_created = (datetime.utcnow() - date_created).days
1193
max_heat = get_max_heat_for_bug(bug_id)
1194
if max_heat is not None and days_since_created > 0:
1196
total_heat + (max_heat * 0.25 / days_since_created))
1198
return int(total_heat)
1202
CREATE FUNCTION cursor_fetch(cur refcursor, n integer) RETURNS SETOF record
1209
FOR count IN 1..n LOOP
1210
FETCH FORWARD FROM cur INTO r;
1220
COMMENT ON FUNCTION cursor_fetch(cur refcursor, n integer) IS 'Fetch the next n items from a cursor. Work around for not being able to use FETCH inside a SELECT statement.';
1223
CREATE FUNCTION debversion(character) RETURNS debversion
1224
LANGUAGE internal IMMUTABLE STRICT
1228
CREATE FUNCTION debversion_cmp(version1 debversion, version2 debversion) RETURNS integer
1229
LANGUAGE c IMMUTABLE STRICT
1230
AS '$libdir/debversion', 'debversion_cmp';
1233
COMMENT ON FUNCTION debversion_cmp(version1 debversion, version2 debversion) IS 'Compare Debian versions';
1236
CREATE FUNCTION debversion_eq(version1 debversion, version2 debversion) RETURNS boolean
1237
LANGUAGE c IMMUTABLE STRICT
1238
AS '$libdir/debversion', 'debversion_eq';
1241
COMMENT ON FUNCTION debversion_eq(version1 debversion, version2 debversion) IS 'debversion equal';
1244
CREATE FUNCTION debversion_ge(version1 debversion, version2 debversion) RETURNS boolean
1245
LANGUAGE c IMMUTABLE STRICT
1246
AS '$libdir/debversion', 'debversion_ge';
1249
COMMENT ON FUNCTION debversion_ge(version1 debversion, version2 debversion) IS 'debversion greater-than-or-equal';
1252
CREATE FUNCTION debversion_gt(version1 debversion, version2 debversion) RETURNS boolean
1253
LANGUAGE c IMMUTABLE STRICT
1254
AS '$libdir/debversion', 'debversion_gt';
1257
COMMENT ON FUNCTION debversion_gt(version1 debversion, version2 debversion) IS 'debversion greater-than';
1260
CREATE FUNCTION debversion_hash(debversion) RETURNS integer
1261
LANGUAGE c IMMUTABLE STRICT
1262
AS '$libdir/debversion', 'debversion_hash';
1265
CREATE FUNCTION debversion_larger(version1 debversion, version2 debversion) RETURNS debversion
1266
LANGUAGE c IMMUTABLE STRICT
1267
AS '$libdir/debversion', 'debversion_larger';
1270
CREATE FUNCTION debversion_le(version1 debversion, version2 debversion) RETURNS boolean
1271
LANGUAGE c IMMUTABLE STRICT
1272
AS '$libdir/debversion', 'debversion_le';
1275
COMMENT ON FUNCTION debversion_le(version1 debversion, version2 debversion) IS 'debversion less-than-or-equal';
1278
CREATE FUNCTION debversion_lt(version1 debversion, version2 debversion) RETURNS boolean
1279
LANGUAGE c IMMUTABLE STRICT
1280
AS '$libdir/debversion', 'debversion_lt';
1283
COMMENT ON FUNCTION debversion_lt(version1 debversion, version2 debversion) IS 'debversion less-than';
1286
CREATE FUNCTION debversion_ne(version1 debversion, version2 debversion) RETURNS boolean
1287
LANGUAGE c IMMUTABLE STRICT
1288
AS '$libdir/debversion', 'debversion_ne';
1291
COMMENT ON FUNCTION debversion_ne(version1 debversion, version2 debversion) IS 'debversion not equal';
1294
CREATE FUNCTION debversion_smaller(version1 debversion, version2 debversion) RETURNS debversion
1295
LANGUAGE c IMMUTABLE STRICT
1296
AS '$libdir/debversion', 'debversion_smaller';
1299
CREATE FUNCTION debversion_sort_key(version text) RETURNS text
1300
LANGUAGE plpythonu IMMUTABLE STRICT
1302
# If this method is altered, then any functional indexes using it
1303
# need to be rebuilt.
1306
VERRE = re.compile("(?:([0-9]+):)?(.+?)(?:-([^-]+))?$")
1308
MAP = "0123456789ABCDEFGHIJKLMNOPQRSTUV"
1310
epoch, version, release = VERRE.match(args[0]).groups()
1312
for part, part_weight in ((epoch, 3000), (version, 2000), (release, 1000)):
1320
key.append(part_weight)
1322
while i != l and part[i].isdigit(): i += 1
1323
key.append(part_weight+int(part[j:i] or "0"))
1328
key.append(part_weight+ord(c))
1331
key.append(part_weight+256+ord(c))
1333
if not key or key[-1] != part_weight:
1334
key.append(part_weight)
1335
key.append(part_weight)
1338
# Encode our key and return it
1343
result.append("000")
1347
element.insert(0, MAP[value & 0x1F])
1349
element_len = len(element)
1351
element.insert(0, "0"*(3-element_len))
1352
elif element_len == 3:
1354
elif element_len < 35:
1355
element.insert(0, MAP[element_len-4])
1356
element.insert(0, "X")
1357
elif element_len < 1027:
1358
element.insert(0, MAP[(element_len-4) & 0x1F])
1359
element.insert(0, MAP[(element_len-4) & 0x3E0])
1360
element.insert(0, "Y")
1362
raise ValueError("Number too large")
1363
result.extend(element)
1364
return "".join(result)
1368
COMMENT ON FUNCTION debversion_sort_key(version text) IS 'Return a string suitable for sorting debian version strings on';
1371
CREATE FUNCTION ensure_bugsummary_temp_journal() RETURNS void
1376
CREATE TEMPORARY TABLE bugsummary_temp_journal (
1377
LIKE bugsummary ) ON COMMIT DROP;
1378
ALTER TABLE bugsummary_temp_journal ALTER COLUMN id DROP NOT NULL;
1380
WHEN duplicate_table THEN
1386
COMMENT ON FUNCTION ensure_bugsummary_temp_journal() IS 'Create a temporary table bugsummary_temp_journal if it does not exist.';
1389
CREATE FUNCTION generate_openid_identifier() RETURNS text
1392
from random import choice
1394
# Non display confusing characters.
1395
chars = '34678bcdefhkmnprstwxyzABCDEFGHJKLMNPQRTWXY'
1397
# Character length of tokens. Can be increased, decreased or even made
1398
# random - Launchpad does not care. 7 means it takes 40 bytes to store
1399
# a null-terminated Launchpad identity URL on the current domain name.
1403
while loop_count < 20000:
1404
# Generate a random openid_identifier
1405
oid = ''.join(choice(chars) for count in range(length))
1407
# Check if the oid is already in the db, although this is pretty
1409
rv = plpy.execute("""
1410
SELECT COUNT(*) AS num FROM Account WHERE openid_identifier = '%s'
1412
if rv[0]['num'] == 0:
1417
'Clash generating unique openid_identifier. '
1418
'Increase length if you see this warning too much.')
1420
"Unable to generate unique openid_identifier. "
1421
"Need to increase length of tokens.")
1425
CREATE FUNCTION getlocalnodeid() RETURNS integer
1426
LANGUAGE plpgsql STABLE SECURITY DEFINER
1427
SET search_path TO public
1432
SELECT INTO v_node_id _sl.getlocalnodeid('_sl');
1435
WHEN invalid_schema_name THEN
1441
COMMENT ON FUNCTION getlocalnodeid() IS 'Return the replication node id for this node, or NULL if not a replicated installation.';
1444
CREATE FUNCTION is_blacklisted_name(text, integer) RETURNS boolean
1445
LANGUAGE sql STABLE STRICT SECURITY DEFINER
1446
SET search_path TO public
1448
SELECT COALESCE(name_blacklist_match($1, $2)::boolean, FALSE);
1452
COMMENT ON FUNCTION is_blacklisted_name(text, integer) IS 'Return TRUE if any regular expressions stored in the NameBlacklist table match the givenname, otherwise return FALSE.';
1455
CREATE FUNCTION is_person(text) RETURNS boolean
1456
LANGUAGE sql STABLE STRICT
1458
SELECT count(*)>0 FROM Person WHERE name=$1 AND teamowner IS NULL;
1462
COMMENT ON FUNCTION is_person(text) IS 'True if the given name identifies a person in the Person table';
1465
CREATE FUNCTION is_printable_ascii(text) RETURNS boolean
1466
LANGUAGE plpythonu IMMUTABLE STRICT
1470
text = args[0].decode("ASCII")
1471
except UnicodeError:
1473
if re.search(r"^[%s]*$" % re.escape(string.printable), text) is None:
1479
COMMENT ON FUNCTION is_printable_ascii(text) IS 'True if the string is pure printable US-ASCII';
1482
CREATE FUNCTION is_team(integer) RETURNS boolean
1483
LANGUAGE sql STABLE STRICT
1485
SELECT count(*)>0 FROM Person WHERE id=$1 AND teamowner IS NOT NULL;
1489
COMMENT ON FUNCTION is_team(integer) IS 'True if the given id identifies a team in the Person table';
1492
CREATE FUNCTION is_team(text) RETURNS boolean
1493
LANGUAGE sql STABLE STRICT
1495
SELECT count(*)>0 FROM Person WHERE name=$1 AND teamowner IS NOT NULL;
1499
COMMENT ON FUNCTION is_team(text) IS 'True if the given name identifies a team in the Person table';
1502
CREATE FUNCTION lp_mirror_account_ins() RETURNS trigger
1503
LANGUAGE plpgsql SECURITY DEFINER
1504
SET search_path TO public
1507
INSERT INTO lp_Account (id, openid_identifier)
1508
VALUES (NEW.id, NEW.openid_identifier);
1509
RETURN NULL; -- Ignored for AFTER triggers.
1514
CREATE FUNCTION lp_mirror_account_upd() RETURNS trigger
1515
LANGUAGE plpgsql SECURITY DEFINER
1516
SET search_path TO public
1519
IF OLD.id <> NEW.id OR OLD.openid_identifier <> NEW.openid_identifier THEN
1521
SET id = NEW.id, openid_identifier = NEW.openid_identifier
1524
RETURN NULL; -- Ignored for AFTER triggers.
1529
CREATE FUNCTION lp_mirror_del() RETURNS trigger
1530
LANGUAGE plpgsql SECURITY DEFINER
1531
SET search_path TO public
1534
EXECUTE 'DELETE FROM lp_' || TG_TABLE_NAME || ' WHERE id=' || OLD.id;
1535
RETURN NULL; -- Ignored for AFTER triggers.
1540
CREATE FUNCTION lp_mirror_openididentifier_del() RETURNS trigger
1541
LANGUAGE plpgsql SECURITY DEFINER
1542
SET search_path TO public
1545
next_identifier text;
1547
SELECT INTO next_identifier identifier FROM OpenIdIdentifier
1548
WHERE account = OLD.account AND identifier <> OLD.identifier
1549
ORDER BY date_created DESC LIMIT 1;
1551
IF next_identifier IS NOT NULL THEN
1552
UPDATE lp_account SET openid_identifier = next_identifier
1553
WHERE openid_identifier = OLD.identifier;
1555
DELETE FROM lp_account WHERE openid_identifier = OLD.identifier;
1558
DELETE FROM lp_OpenIdIdentifier WHERE identifier = OLD.identifier;
1560
RETURN NULL; -- Ignored for AFTER triggers.
1565
CREATE FUNCTION lp_mirror_openididentifier_ins() RETURNS trigger
1566
LANGUAGE plpgsql SECURITY DEFINER
1567
SET search_path TO public
1570
-- Support obsolete lp_Account.openid_identifier as best we can
1571
-- until ISD migrates to using lp_OpenIdIdentifier.
1572
UPDATE lp_account SET openid_identifier = NEW.identifier
1573
WHERE id = NEW.account;
1575
INSERT INTO lp_account (id, openid_identifier)
1576
VALUES (NEW.account, NEW.identifier);
1579
INSERT INTO lp_OpenIdIdentifier (identifier, account, date_created)
1580
VALUES (NEW.identifier, NEW.account, NEW.date_created);
1582
RETURN NULL; -- Ignored for AFTER triggers.
1587
CREATE FUNCTION lp_mirror_openididentifier_upd() RETURNS trigger
1588
LANGUAGE plpgsql SECURITY DEFINER
1589
SET search_path TO public
1592
IF OLD.identifier <> NEW.identifier THEN
1593
UPDATE lp_Account SET openid_identifier = NEW.identifier
1594
WHERE openid_identifier = OLD.identifier;
1596
UPDATE lp_OpenIdIdentifier
1598
identifier = NEW.identifier,
1599
account = NEW.account,
1600
date_created = NEW.date_created
1601
WHERE identifier = OLD.identifier;
1602
RETURN NULL; -- Ignored for AFTER triggers.
1607
CREATE FUNCTION lp_mirror_person_ins() RETURNS trigger
1608
LANGUAGE plpgsql SECURITY DEFINER
1609
SET search_path TO public
1612
INSERT INTO lp_Person (
1613
id, displayname, teamowner, teamdescription, name, language, fti,
1614
defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy,
1615
merged, datecreated, homepage_content, icon, mugshot,
1616
hide_email_addresses, creation_rationale, creation_comment,
1617
registrant, logo, renewal_policy, personal_standing,
1618
personal_standing_reason, mail_resumption_date,
1619
mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates,
1620
visibility, verbose_bugnotifications, account)
1622
NEW.id, NEW.displayname, NEW.teamowner, NULL,
1623
NEW.name, NEW.language, NEW.fti, NEW.defaultmembershipperiod,
1624
NEW.defaultrenewalperiod, NEW.subscriptionpolicy,
1625
NEW.merged, NEW.datecreated, NULL, NEW.icon,
1626
NEW.mugshot, NEW.hide_email_addresses, NEW.creation_rationale,
1627
NEW.creation_comment, NEW.registrant, NEW.logo, NEW.renewal_policy,
1628
NEW.personal_standing, NEW.personal_standing_reason,
1629
NEW.mail_resumption_date, NEW.mailing_list_auto_subscribe_policy,
1630
NEW.mailing_list_receive_duplicates, NEW.visibility,
1631
NEW.verbose_bugnotifications, NEW.account);
1632
RETURN NULL; -- Ignored for AFTER triggers.
1637
CREATE FUNCTION lp_mirror_person_upd() RETURNS trigger
1638
LANGUAGE plpgsql SECURITY DEFINER
1639
SET search_path TO public
1644
displayname = NEW.displayname,
1645
teamowner = NEW.teamowner,
1646
teamdescription = NULL,
1648
language = NEW.language,
1650
defaultmembershipperiod = NEW.defaultmembershipperiod,
1651
defaultrenewalperiod = NEW.defaultrenewalperiod,
1652
subscriptionpolicy = NEW.subscriptionpolicy,
1653
merged = NEW.merged,
1654
datecreated = NEW.datecreated,
1655
homepage_content = NULL,
1657
mugshot = NEW.mugshot,
1658
hide_email_addresses = NEW.hide_email_addresses,
1659
creation_rationale = NEW.creation_rationale,
1660
creation_comment = NEW.creation_comment,
1661
registrant = NEW.registrant,
1663
renewal_policy = NEW.renewal_policy,
1664
personal_standing = NEW.personal_standing,
1665
personal_standing_reason = NEW.personal_standing_reason,
1666
mail_resumption_date = NEW.mail_resumption_date,
1667
mailing_list_auto_subscribe_policy
1668
= NEW.mailing_list_auto_subscribe_policy,
1669
mailing_list_receive_duplicates = NEW.mailing_list_receive_duplicates,
1670
visibility = NEW.visibility,
1671
verbose_bugnotifications = NEW.verbose_bugnotifications,
1672
account = NEW.account
1674
RETURN NULL; -- Ignored for AFTER triggers.
1679
CREATE FUNCTION lp_mirror_personlocation_ins() RETURNS trigger
1680
LANGUAGE plpgsql SECURITY DEFINER
1681
SET search_path TO public
1684
INSERT INTO lp_PersonLocation SELECT NEW.*;
1685
RETURN NULL; -- Ignored for AFTER triggers.
1690
CREATE FUNCTION lp_mirror_personlocation_upd() RETURNS trigger
1691
LANGUAGE plpgsql SECURITY DEFINER
1692
SET search_path TO public
1695
UPDATE lp_PersonLocation
1697
date_created = NEW.date_created,
1698
person = NEW.person,
1699
latitude = NEW.latitude,
1700
longitude = NEW.longitude,
1701
time_zone = NEW.time_zone,
1702
last_modified_by = NEW.last_modified_by,
1703
date_last_modified = NEW.date_last_modified,
1704
visible = NEW.visible,
1707
RETURN NULL; -- Ignored for AFTER triggers.
1712
CREATE FUNCTION lp_mirror_teamparticipation_ins() RETURNS trigger
1713
LANGUAGE plpgsql SECURITY DEFINER
1714
SET search_path TO public
1717
INSERT INTO lp_TeamParticipation SELECT NEW.*;
1718
RETURN NULL; -- Ignored for AFTER triggers.
1723
CREATE FUNCTION lp_mirror_teamparticipation_upd() RETURNS trigger
1724
LANGUAGE plpgsql SECURITY DEFINER
1725
SET search_path TO public
1728
UPDATE lp_TeamParticipation
1733
RETURN NULL; -- Ignored for AFTER triggers.
1738
CREATE FUNCTION maintain_transitively_private() RETURNS trigger
1742
IF TG_OP = 'UPDATE' THEN
1743
IF (NEW.stacked_on IS NOT DISTINCT FROM OLD.stacked_on
1744
AND NEW.private IS NOT DISTINCT FROM OLD.private) THEN
1748
PERFORM update_transitively_private(NEW.id);
1754
COMMENT ON FUNCTION maintain_transitively_private() IS 'Trigger maintaining the Branch transitively_private column';
1757
CREATE FUNCTION message_copy_owner_to_bugmessage() RETURNS trigger
1758
LANGUAGE plpgsql SECURITY DEFINER
1759
SET search_path TO public
1762
IF NEW.owner != OLD.owner THEN
1764
SET owner = NEW.owner
1766
BugMessage.message = NEW.id;
1768
RETURN NULL; -- Ignored - this is an AFTER trigger
1773
COMMENT ON FUNCTION message_copy_owner_to_bugmessage() IS 'Copies the message owner into bugmessage when message changes.';
1776
CREATE FUNCTION message_copy_owner_to_questionmessage() RETURNS trigger
1777
LANGUAGE plpgsql SECURITY DEFINER
1778
SET search_path TO public
1781
IF NEW.owner != OLD.owner THEN
1782
UPDATE QuestionMessage
1783
SET owner = NEW.owner
1785
QuestionMessage.message = NEW.id;
1787
RETURN NULL; -- Ignored - this is an AFTER trigger
1792
COMMENT ON FUNCTION message_copy_owner_to_questionmessage() IS 'Copies the message owner into questionmessage when message changes.';
1795
CREATE FUNCTION milestone_sort_key(dateexpected timestamp without time zone, name text) RETURNS text
1796
LANGUAGE plpythonu IMMUTABLE
1798
# If this method is altered, then any functional indexes using it
1799
# need to be rebuilt.
1803
date_expected, name = args
1805
def substitute_filled_numbers(match):
1806
return match.group(0).zfill(5)
1808
name = re.sub(u'\d+', substitute_filled_numbers, name)
1809
if date_expected is None:
1810
# NULL dates are considered to be in the future.
1811
date_expected = datetime.datetime(datetime.MAXYEAR, 1, 1)
1812
return '%s %s' % (date_expected, name)
1816
COMMENT ON FUNCTION milestone_sort_key(dateexpected timestamp without time zone, name text) IS 'Sort by the Milestone dateexpected and name. If the dateexpected is NULL, then it is converted to a date far in the future, so it will be sorted as a milestone in the future.';
1819
CREATE FUNCTION mv_branch_distribution_update() RETURNS trigger
1823
IF OLD.id != NEW.id THEN
1824
RAISE EXCEPTION 'Cannot change Distribution.id';
1826
IF OLD.name != NEW.name THEN
1827
UPDATE Branch SET unique_name = NULL
1829
WHERE Branch.distroseries = Distroseries.id
1830
AND Distroseries.distribution = NEW.id;
1837
COMMENT ON FUNCTION mv_branch_distribution_update() IS 'Maintain Branch name cache when Distribution is modified.';
1840
CREATE FUNCTION mv_branch_distroseries_update() RETURNS trigger
1844
IF OLD.id != NEW.id THEN
1845
RAISE EXCEPTION 'Cannot change Distroseries.id';
1847
IF OLD.name != NEW.name THEN
1848
UPDATE Branch SET unique_name = NULL
1849
WHERE Branch.distroseries = NEW.id;
1856
COMMENT ON FUNCTION mv_branch_distroseries_update() IS 'Maintain Branch name cache when Distroseries is modified.';
1859
CREATE FUNCTION mv_branch_person_update() RETURNS trigger
1865
IF OLD.id != NEW.id THEN
1866
RAISE EXCEPTION 'Cannot change Person.id';
1868
IF OLD.name != NEW.name THEN
1869
UPDATE Branch SET owner_name = NEW.name WHERE owner = NEW.id;
1876
COMMENT ON FUNCTION mv_branch_person_update() IS 'Maintain Branch name cache when Person is modified.';
1879
CREATE FUNCTION mv_branch_product_update() RETURNS trigger
1885
IF OLD.id != NEW.id THEN
1886
RAISE EXCEPTION 'Cannot change Product.id';
1888
IF OLD.name != NEW.name THEN
1889
UPDATE Branch SET target_suffix = NEW.name WHERE product=NEW.id;
1896
COMMENT ON FUNCTION mv_branch_product_update() IS 'Maintain Branch name cache when Product is modified.';
1899
CREATE FUNCTION mv_pillarname_distribution() RETURNS trigger
1900
LANGUAGE plpgsql SECURITY DEFINER
1901
SET search_path TO public
1904
IF TG_OP = 'INSERT' THEN
1905
INSERT INTO PillarName (name, distribution)
1906
VALUES (NEW.name, NEW.id);
1907
ELSIF NEW.name != OLD.name THEN
1908
UPDATE PillarName SET name=NEW.name WHERE distribution=NEW.id;
1910
RETURN NULL; -- Ignored - this is an AFTER trigger
1915
COMMENT ON FUNCTION mv_pillarname_distribution() IS 'Trigger maintaining the PillarName table';
1918
CREATE FUNCTION mv_pillarname_product() RETURNS trigger
1919
LANGUAGE plpgsql SECURITY DEFINER
1920
SET search_path TO public
1923
IF TG_OP = 'INSERT' THEN
1924
INSERT INTO PillarName (name, product, active)
1925
VALUES (NEW.name, NEW.id, NEW.active);
1926
ELSIF NEW.name != OLD.name OR NEW.active != OLD.active THEN
1927
UPDATE PillarName SET name=NEW.name, active=NEW.active
1928
WHERE product=NEW.id;
1930
RETURN NULL; -- Ignored - this is an AFTER trigger
1935
COMMENT ON FUNCTION mv_pillarname_product() IS 'Trigger maintaining the PillarName table';
1938
CREATE FUNCTION mv_pillarname_project() RETURNS trigger
1939
LANGUAGE plpgsql SECURITY DEFINER
1940
SET search_path TO public
1943
IF TG_OP = 'INSERT' THEN
1944
INSERT INTO PillarName (name, project, active)
1945
VALUES (NEW.name, NEW.id, NEW.active);
1946
ELSIF NEW.name != OLD.name or NEW.active != OLD.active THEN
1947
UPDATE PillarName SET name=NEW.name, active=NEW.active
1948
WHERE project=NEW.id;
1950
RETURN NULL; -- Ignored - this is an AFTER trigger
1955
COMMENT ON FUNCTION mv_pillarname_project() IS 'Trigger maintaining the PillarName table';
1958
CREATE FUNCTION mv_pofiletranslator_pomsgset() RETURNS trigger
1962
IF TG_OP = 'DELETE' THEN
1964
'Deletions from POMsgSet not supported by the POFileTranslator materialized view';
1965
ELSIF TG_OP = 'UPDATE' THEN
1966
IF OLD.pofile != NEW.pofile THEN
1968
'Changing POMsgSet.pofile not supported by the POFileTranslator materialized view';
1976
COMMENT ON FUNCTION mv_pofiletranslator_pomsgset() IS 'Trigger enforing no POMsgSet deletions or POMsgSet.pofile changes';
1979
CREATE FUNCTION mv_pofiletranslator_posubmission() RETURNS trigger
1980
LANGUAGE plpgsql SECURITY DEFINER
1984
v_trash_old BOOLEAN;
1986
-- If we are deleting a row, we need to remove the existing
1987
-- POFileTranslator row and reinsert the historical data if it exists.
1988
-- We also treat UPDATEs that change the key (person, pofile) the same
1989
-- as deletes. UPDATEs that don't change these columns are treated like
1991
IF TG_OP = 'INSERT' THEN
1992
v_trash_old := FALSE;
1993
ELSIF TG_OP = 'DELETE' THEN
1994
v_trash_old := TRUE;
1997
OLD.person != NEW.person OR OLD.pomsgset != NEW.pomsgset
2003
-- Delete the old record.
2004
DELETE FROM POFileTranslator USING POMsgSet
2005
WHERE POFileTranslator.pofile = POMsgSet.pofile
2006
AND POFileTranslator.person = OLD.person
2007
AND POMsgSet.id = OLD.pomsgset;
2009
-- Insert a past record if there is one.
2010
INSERT INTO POFileTranslator (
2011
person, pofile, latest_posubmission, date_last_touched
2013
SELECT DISTINCT ON (POSubmission.person, POMsgSet.pofile)
2014
POSubmission.person, POMsgSet.pofile,
2015
POSubmission.id, POSubmission.datecreated
2016
FROM POSubmission, POMsgSet
2017
WHERE POSubmission.pomsgset = POMsgSet.id
2018
AND POSubmission.pomsgset = OLD.pomsgset
2019
AND POSubmission.person = OLD.person
2021
POSubmission.person, POMsgSet.pofile,
2022
POSubmission.datecreated DESC, POSubmission.id DESC;
2024
-- No NEW with DELETE, so we can short circuit and leave.
2025
IF TG_OP = 'DELETE' THEN
2026
RETURN NULL; -- Ignored because this is an AFTER trigger
2030
-- Get our new pofile id
2031
SELECT INTO v_pofile POMsgSet.pofile FROM POMsgSet
2032
WHERE POMsgSet.id = NEW.pomsgset;
2034
-- Standard 'upsert' loop to avoid race conditions.
2036
UPDATE POFileTranslator
2038
date_last_touched = CURRENT_TIMESTAMP AT TIME ZONE 'UTC',
2039
latest_posubmission = NEW.id
2042
AND pofile = v_pofile;
2044
RETURN NULL; -- Return value ignored as this is an AFTER trigger
2048
INSERT INTO POFileTranslator (person, pofile, latest_posubmission)
2049
VALUES (NEW.person, v_pofile, NEW.id);
2050
RETURN NULL; -- Return value ignored as this is an AFTER trigger
2051
EXCEPTION WHEN unique_violation THEN
2059
COMMENT ON FUNCTION mv_pofiletranslator_posubmission() IS 'Trigger maintaining the POFileTranslator table';
2062
CREATE FUNCTION mv_pofiletranslator_translationmessage() RETURNS trigger
2063
LANGUAGE plpgsql SECURITY DEFINER
2064
SET search_path TO public
2067
v_trash_old BOOLEAN;
2069
-- If we are deleting a row, we need to remove the existing
2070
-- POFileTranslator row and reinsert the historical data if it exists.
2071
-- We also treat UPDATEs that change the key (submitter) the same
2072
-- as deletes. UPDATEs that don't change these columns are treated like
2074
IF TG_OP = 'INSERT' THEN
2075
v_trash_old := FALSE;
2076
ELSIF TG_OP = 'DELETE' THEN
2077
v_trash_old := TRUE;
2080
OLD.submitter != NEW.submitter
2085
-- Was this somebody's most-recently-changed message?
2086
-- If so, delete the entry for that change.
2087
DELETE FROM POFileTranslator
2088
WHERE latest_message = OLD.id;
2090
-- We deleted the entry for somebody's latest contribution.
2091
-- Find that person's latest remaining contribution and
2092
-- create a new record for that.
2093
INSERT INTO POFileTranslator (
2094
person, pofile, latest_message, date_last_touched
2096
SELECT DISTINCT ON (person, pofile.id)
2097
new_latest_message.submitter AS person,
2099
new_latest_message.id,
2100
greatest(new_latest_message.date_created,
2101
new_latest_message.date_reviewed)
2103
JOIN TranslationTemplateItem AS old_template_item
2104
ON OLD.potmsgset = old_template_item.potmsgset AND
2105
old_template_item.potemplate = pofile.potemplate AND
2106
pofile.language = OLD.language
2107
JOIN TranslationTemplateItem AS new_template_item
2108
ON (old_template_item.potemplate =
2109
new_template_item.potemplate)
2110
JOIN TranslationMessage AS new_latest_message
2111
ON new_latest_message.potmsgset =
2112
new_template_item.potmsgset AND
2113
new_latest_message.language = OLD.language
2114
LEFT OUTER JOIN POfileTranslator AS ExistingEntry
2115
ON ExistingEntry.person = OLD.submitter AND
2116
ExistingEntry.pofile = POFile.id
2118
new_latest_message.submitter = OLD.submitter AND
2119
ExistingEntry IS NULL
2120
ORDER BY new_latest_message.submitter, pofile.id,
2121
new_latest_message.date_created DESC,
2122
new_latest_message.id DESC;
2125
-- No NEW with DELETE, so we can short circuit and leave.
2126
IF TG_OP = 'DELETE' THEN
2127
RETURN NULL; -- Ignored because this is an AFTER trigger
2131
-- Standard 'upsert' loop to avoid race conditions.
2133
UPDATE POFileTranslator
2135
date_last_touched = CURRENT_TIMESTAMP AT TIME ZONE 'UTC',
2136
latest_message = NEW.id
2137
FROM POFile, TranslationTemplateItem
2138
WHERE person = NEW.submitter AND
2139
TranslationTemplateItem.potmsgset=NEW.potmsgset AND
2140
TranslationTemplateItem.potemplate=pofile.potemplate AND
2141
pofile.language=NEW.language AND
2142
POFileTranslator.pofile = pofile.id;
2144
RETURN NULL; -- Return value ignored as this is an AFTER trigger
2148
INSERT INTO POFileTranslator (person, pofile, latest_message)
2149
SELECT DISTINCT ON (NEW.submitter, pofile.id)
2150
NEW.submitter, pofile.id, NEW.id
2151
FROM TranslationTemplateItem
2153
ON pofile.language = NEW.language AND
2154
pofile.potemplate = translationtemplateitem.potemplate
2156
TranslationTemplateItem.potmsgset = NEW.potmsgset;
2157
RETURN NULL; -- Return value ignored as this is an AFTER trigger
2158
EXCEPTION WHEN unique_violation THEN
2166
COMMENT ON FUNCTION mv_pofiletranslator_translationmessage() IS 'Trigger maintaining the POFileTranslator table';
2169
CREATE FUNCTION mv_validpersonorteamcache_emailaddress() RETURNS trigger
2170
LANGUAGE plpythonu SECURITY DEFINER
2172
# This trigger function keeps the ValidPersonOrTeamCache materialized
2173
# view in sync when updates are made to the EmailAddress table.
2174
# Note that if the corresponding person is a team, changes to this table
2176
PREF = 4 # Constant indicating preferred email address
2178
if not SD.has_key("delete_plan"):
2179
param_types = ["int4"]
2181
SD["is_team"] = plpy.prepare("""
2182
SELECT teamowner IS NOT NULL AS is_team FROM Person WHERE id = $1
2185
SD["delete_plan"] = plpy.prepare("""
2186
DELETE FROM ValidPersonOrTeamCache WHERE id = $1
2189
SD["insert_plan"] = plpy.prepare("""
2190
INSERT INTO ValidPersonOrTeamCache (id) VALUES ($1)
2193
SD["maybe_insert_plan"] = plpy.prepare("""
2194
INSERT INTO ValidPersonOrTeamCache (id)
2197
JOIN EmailAddress ON Person.id = EmailAddress.person
2198
LEFT OUTER JOIN ValidPersonOrTeamCache
2199
ON Person.id = ValidPersonOrTeamCache.id
2200
WHERE Person.id = $1
2201
AND ValidPersonOrTeamCache.id IS NULL
2202
AND status = %(PREF)d
2204
-- AND password IS NOT NULL
2205
""" % vars(), param_types)
2207
def is_team(person_id):
2208
"""Return true if person_id corresponds to a team"""
2209
if person_id is None:
2211
return plpy.execute(SD["is_team"], [person_id], 1)[0]["is_team"]
2214
def __getitem__(self, key):
2217
old = TD["old"] or NoneDict()
2218
new = TD["new"] or NoneDict()
2220
#plpy.info("old.id == %s" % old["id"])
2221
#plpy.info("old.person == %s" % old["person"])
2222
#plpy.info("old.status == %s" % old["status"])
2223
#plpy.info("new.id == %s" % new["id"])
2224
#plpy.info("new.person == %s" % new["person"])
2225
#plpy.info("new.status == %s" % new["status"])
2227
# Short circuit if neither person nor status has changed
2228
if old["person"] == new["person"] and old["status"] == new["status"]:
2231
# Short circuit if we are not mucking around with preferred email
2233
if old["status"] != PREF and new["status"] != PREF:
2236
# Note that we have a constraint ensuring that there is only one
2237
# status == PREF email address per person at any point in time.
2238
# This simplifies our logic, as we know that if old.status == PREF,
2239
# old.person does not have any other preferred email addresses.
2240
# Also if new.status == PREF, we know new.person previously did not
2241
# have a preferred email address.
2243
if old["person"] != new["person"]:
2244
if old["status"] == PREF and not is_team(old["person"]):
2245
# old.person is no longer valid, unless they are a team
2246
plpy.execute(SD["delete_plan"], [old["person"]])
2247
if new["status"] == PREF and not is_team(new["person"]):
2248
# new["person"] is now valid, or unchanged if they are a team
2249
plpy.execute(SD["insert_plan"], [new["person"]])
2251
elif old["status"] == PREF and not is_team(old["person"]):
2252
# No longer valid, or unchanged if they are a team
2253
plpy.execute(SD["delete_plan"], [old["person"]])
2255
elif new["status"] == PREF and not is_team(new["person"]):
2256
# May now be valid, or unchanged if they are a team.
2257
plpy.execute(SD["maybe_insert_plan"], [new["person"]])
2261
COMMENT ON FUNCTION mv_validpersonorteamcache_emailaddress() IS 'A trigger for maintaining the ValidPersonOrTeamCache eager materialized view when changes are made to the EmailAddress table';
2264
CREATE FUNCTION mv_validpersonorteamcache_person() RETURNS trigger
2265
LANGUAGE plpythonu SECURITY DEFINER
2267
# This trigger function could be simplified by simply issuing
2268
# one DELETE followed by one INSERT statement. However, we want to minimize
2269
# expensive writes so we use this more complex logic.
2270
PREF = 4 # Constant indicating preferred email address
2272
if not SD.has_key("delete_plan"):
2273
param_types = ["int4"]
2275
SD["delete_plan"] = plpy.prepare("""
2276
DELETE FROM ValidPersonOrTeamCache WHERE id = $1
2279
SD["maybe_insert_plan"] = plpy.prepare("""
2280
INSERT INTO ValidPersonOrTeamCache (id)
2283
LEFT OUTER JOIN EmailAddress
2284
ON Person.id = EmailAddress.person AND status = %(PREF)d
2285
LEFT OUTER JOIN ValidPersonOrTeamCache
2286
ON Person.id = ValidPersonOrTeamCache.id
2287
WHERE Person.id = $1
2288
AND ValidPersonOrTeamCache.id IS NULL
2290
AND (teamowner IS NOT NULL OR EmailAddress.id IS NOT NULL)
2291
""" % vars(), param_types)
2296
# We should always have new, as this is not a DELETE trigger
2297
assert new is not None, 'New is None'
2299
person_id = new["id"]
2300
query_params = [person_id] # All the same
2302
# Short circuit if this is a new person (not team), as it cannot
2303
# be valid until a status == 4 EmailAddress entry has been created
2304
# (unless it is a team, in which case it is valid on creation)
2306
if new["teamowner"] is not None:
2307
plpy.execute(SD["maybe_insert_plan"], query_params)
2310
# Short circuit if there are no relevant changes
2311
if (new["teamowner"] == old["teamowner"]
2312
and new["merged"] == old["merged"]):
2315
# This function is only dealing with updates to the Person table.
2316
# This means we do not have to worry about EmailAddress changes here
2318
if (new["merged"] is not None or new["teamowner"] is None):
2319
plpy.execute(SD["delete_plan"], query_params)
2321
plpy.execute(SD["maybe_insert_plan"], query_params)
2325
COMMENT ON FUNCTION mv_validpersonorteamcache_person() IS 'A trigger for maintaining the ValidPersonOrTeamCache eager materialized view when changes are made to the Person table';
2328
CREATE FUNCTION name_blacklist_match(text, integer) RETURNS integer
2329
LANGUAGE plpythonu STABLE STRICT SECURITY DEFINER
2330
SET search_path TO public
2333
name = args[0].decode("UTF-8")
2336
# Initialize shared storage, shared between invocations.
2337
if not SD.has_key("regexp_select_plan"):
2339
# All the blacklist regexps except the ones we are an admin
2340
# for. These we do not check since they are not blacklisted to us.
2341
SD["regexp_select_plan"] = plpy.prepare("""
2342
SELECT id, regexp FROM NameBlacklist
2343
WHERE admin IS NULL OR admin NOT IN (
2344
SELECT team FROM TeamParticipation
2349
# Storage for compiled regexps
2352
# admins is a celebrity and its id is immutable.
2353
admins_id = plpy.execute(
2354
"SELECT id FROM Person WHERE name='admins'")[0]["id"]
2356
SD["admin_select_plan"] = plpy.prepare("""
2357
SELECT TRUE FROM TeamParticipation
2359
TeamParticipation.team = %d
2360
AND TeamParticipation.person = $1
2362
""" % admins_id, ["integer"])
2364
# All the blacklist regexps except those that have an admin because
2365
# members of ~admin can use any name that any other admin can use.
2366
SD["admin_regexp_select_plan"] = plpy.prepare("""
2367
SELECT id, regexp FROM NameBlacklist
2373
compiled = SD["compiled"]
2375
# Names are never blacklisted for Lauchpad admins.
2376
if user_id is not None and plpy.execute(
2377
SD["admin_select_plan"], [user_id]).nrows() > 0:
2378
blacklist_plan = "admin_regexp_select_plan"
2380
blacklist_plan = "regexp_select_plan"
2382
for row in plpy.execute(SD[blacklist_plan], [user_id]):
2383
regexp_id = row["id"]
2384
regexp_txt = row["regexp"]
2385
if (compiled.get(regexp_id) is None
2386
or compiled[regexp_id][0] != regexp_txt):
2387
regexp = re.compile(
2388
regexp_txt, re.IGNORECASE | re.UNICODE | re.VERBOSE
2390
compiled[regexp_id] = (regexp_txt, regexp)
2392
regexp = compiled[regexp_id][1]
2393
if regexp.search(name) is not None:
2399
COMMENT ON FUNCTION name_blacklist_match(text, integer) IS 'Return the id of the row in the NameBlacklist table that matches the given name, or NULL if no regexps in the NameBlacklist table match.';
2402
CREATE FUNCTION null_count(p_values anyarray) RETURNS integer
2403
LANGUAGE plpgsql IMMUTABLE STRICT
2407
v_null_count integer := 0;
2409
FOR v_index IN array_lower(p_values,1)..array_upper(p_values,1) LOOP
2410
IF p_values[v_index] IS NULL THEN
2411
v_null_count := v_null_count + 1;
2414
RETURN v_null_count;
2419
COMMENT ON FUNCTION null_count(p_values anyarray) IS 'Return the number of NULLs in the first row of the given array.';
2422
CREATE FUNCTION packageset_deleted_trig() RETURNS trigger
2426
DELETE FROM flatpackagesetinclusion
2427
WHERE parent = OLD.id AND child = OLD.id;
2429
-- A package set was deleted; it may have participated in package set
2430
-- inclusion relations in a sub/superset role; delete all inclusion
2431
-- relationships in which it participated.
2432
DELETE FROM packagesetinclusion
2433
WHERE parent = OLD.id OR child = OLD.id;
2439
COMMENT ON FUNCTION packageset_deleted_trig() IS 'Remove any DAG edges leading to/from the deleted package set.';
2442
CREATE FUNCTION packageset_inserted_trig() RETURNS trigger
2446
-- A new package set was inserted; make it a descendent of itself in
2447
-- the flattened package set inclusion table in order to facilitate
2449
INSERT INTO flatpackagesetinclusion(parent, child)
2450
VALUES (NEW.id, NEW.id);
2456
COMMENT ON FUNCTION packageset_inserted_trig() IS 'Insert self-referencing DAG edge when a new package set is inserted.';
2459
CREATE FUNCTION packagesetinclusion_deleted_trig() RETURNS trigger
2463
-- A package set inclusion relationship was deleted i.e. a set M
2464
-- ceases to include another set N as a subset.
2465
-- For an explanation of the queries below please see page 5 of
2466
-- "Maintaining Transitive Closure of Graphs in SQL"
2467
-- http://www.comp.nus.edu.sg/~wongls/psZ/dlsw-ijit97-16.ps
2468
CREATE TEMP TABLE tmp_fpsi_suspect(
2469
parent integer NOT NULL,
2470
child integer NOT NULL);
2471
CREATE TEMP TABLE tmp_fpsi_trusted(
2472
parent integer NOT NULL,
2473
child integer NOT NULL);
2474
CREATE TEMP TABLE tmp_fpsi_good(
2475
parent integer NOT NULL,
2476
child integer NOT NULL);
2478
INSERT INTO tmp_fpsi_suspect (
2479
SELECT X.parent, Y.child
2480
FROM flatpackagesetinclusion X, flatpackagesetinclusion Y
2481
WHERE X.child = OLD.parent AND Y.parent = OLD.child
2483
SELECT X.parent, OLD.child FROM flatpackagesetinclusion X
2484
WHERE X.child = OLD.parent
2486
SELECT OLD.parent, X.child FROM flatpackagesetinclusion X
2487
WHERE X.parent = OLD.child
2489
SELECT OLD.parent, OLD.child
2492
INSERT INTO tmp_fpsi_trusted (
2493
SELECT parent, child FROM flatpackagesetinclusion
2495
SELECT parent, child FROM tmp_fpsi_suspect
2497
SELECT parent, child FROM packagesetinclusion psi
2498
WHERE psi.parent != OLD.parent AND psi.child != OLD.child
2501
INSERT INTO tmp_fpsi_good (
2502
SELECT parent, child FROM tmp_fpsi_trusted
2504
SELECT T1.parent, T2.child
2505
FROM tmp_fpsi_trusted T1, tmp_fpsi_trusted T2
2506
WHERE T1.child = T2.parent
2508
SELECT T1.parent, T3.child
2509
FROM tmp_fpsi_trusted T1, tmp_fpsi_trusted T2, tmp_fpsi_trusted T3
2510
WHERE T1.child = T2.parent AND T2.child = T3.parent
2513
DELETE FROM flatpackagesetinclusion fpsi
2515
SELECT * FROM tmp_fpsi_good T
2516
WHERE T.parent = fpsi.parent AND T.child = fpsi.child);
2518
DROP TABLE tmp_fpsi_good;
2519
DROP TABLE tmp_fpsi_trusted;
2520
DROP TABLE tmp_fpsi_suspect;
2527
COMMENT ON FUNCTION packagesetinclusion_deleted_trig() IS 'Maintain the transitive closure in the DAG when an edge leading to/from a package set is deleted.';
2530
CREATE FUNCTION packagesetinclusion_inserted_trig() RETURNS trigger
2537
parent_distroseries text;
2538
child_distroseries text;
2540
-- Make sure that the package sets being associated here belong
2541
-- to the same distro series.
2542
IF (SELECT parent.distroseries != child.distroseries
2543
FROM packageset parent, packageset child
2544
WHERE parent.id = NEW.parent AND child.id = NEW.child)
2546
SELECT name INTO parent_name FROM packageset WHERE id = NEW.parent;
2547
SELECT name INTO child_name FROM packageset WHERE id = NEW.child;
2548
SELECT ds.name INTO parent_distroseries FROM packageset ps, distroseries ds WHERE ps.id = NEW.parent AND ps.distroseries = ds.id;
2549
SELECT ds.name INTO child_distroseries FROM packageset ps, distroseries ds WHERE ps.id = NEW.child AND ps.distroseries = ds.id;
2550
RAISE EXCEPTION 'Package sets % and % belong to different distro series (to % and % respectively) and thus cannot be associated.', child_name, parent_name, child_distroseries, parent_distroseries;
2554
SELECT * FROM flatpackagesetinclusion
2555
WHERE parent = NEW.child AND child = NEW.parent LIMIT 1)
2557
SELECT name INTO parent_name FROM packageset WHERE id = NEW.parent;
2558
SELECT name INTO child_name FROM packageset WHERE id = NEW.child;
2559
RAISE EXCEPTION 'Package set % already includes %. Adding (% -> %) would introduce a cycle in the package set graph (DAG).', child_name, parent_name, parent_name, child_name;
2562
-- A new package set inclusion relationship was inserted i.e. a set M
2563
-- now includes another set N as a subset.
2564
-- For an explanation of the queries below please see page 4 of
2565
-- "Maintaining Transitive Closure of Graphs in SQL"
2566
-- http://www.comp.nus.edu.sg/~wongls/psZ/dlsw-ijit97-16.ps
2567
CREATE TEMP TABLE tmp_fpsi_new(
2568
parent integer NOT NULL,
2569
child integer NOT NULL);
2571
INSERT INTO tmp_fpsi_new (
2573
X.parent AS parent, NEW.child AS child
2574
FROM flatpackagesetinclusion X WHERE X.child = NEW.parent
2577
NEW.parent AS parent, X.child AS child
2578
FROM flatpackagesetinclusion X WHERE X.parent = NEW.child
2581
X.parent AS parent, Y.child AS child
2582
FROM flatpackagesetinclusion X, flatpackagesetinclusion Y
2583
WHERE X.child = NEW.parent AND Y.parent = NEW.child
2585
INSERT INTO tmp_fpsi_new(parent, child) VALUES(NEW.parent, NEW.child);
2587
INSERT INTO flatpackagesetinclusion(parent, child) (
2589
parent, child FROM tmp_fpsi_new
2591
SELECT F.parent, F.child FROM flatpackagesetinclusion F
2594
DROP TABLE tmp_fpsi_new;
2601
COMMENT ON FUNCTION packagesetinclusion_inserted_trig() IS 'Maintain the transitive closure in the DAG for a newly inserted edge leading to/from a package set.';
2604
CREATE FUNCTION person_sort_key(displayname text, name text) RETURNS text
2605
LANGUAGE plpythonu IMMUTABLE STRICT
2607
# NB: If this implementation is changed, the person_sort_idx needs to be
2608
# rebuilt along with any other indexes using it.
2612
strip_re = SD["strip_re"]
2614
strip_re = re.compile("(?:[^\w\s]|[\d_])", re.U)
2615
SD["strip_re"] = strip_re
2617
displayname, name = args
2619
# Strip noise out of displayname. We do not have to bother with
2620
# name, as we know it is just plain ascii.
2621
displayname = strip_re.sub('', displayname.decode('UTF-8').lower())
2622
return ("%s, %s" % (displayname.strip(), name)).encode('UTF-8')
2626
COMMENT ON FUNCTION person_sort_key(displayname text, name text) IS 'Return a string suitable for sorting people on, generated by stripping noise out of displayname and concatenating name';
43
2629
CREATE FUNCTION pgstattuple(text) RETURNS pgstattuple_type
44
AS '$libdir/pgstattuple', 'pgstattuple'
2631
AS '$libdir/pgstattuple', 'pgstattuple';
47
2634
CREATE FUNCTION pgstattuple(oid) RETURNS pgstattuple_type
48
AS '$libdir/pgstattuple', 'pgstattuplebyid'
2636
AS '$libdir/pgstattuple', 'pgstattuplebyid';
51
2639
CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler
52
AS '$libdir/plpgsql', 'plpgsql_call_handler'
2641
AS '$libdir/plpgsql', 'plpgsql_call_handler';
55
2644
CREATE FUNCTION plpython_call_handler() RETURNS language_handler
56
AS '$libdir/plpython', 'plpython_call_handler'
2646
AS '$libdir/plpython', 'plpython_call_handler';
2649
CREATE FUNCTION questionmessage_copy_owner_from_message() RETURNS trigger
2650
LANGUAGE plpgsql SECURITY DEFINER
2651
SET search_path TO public
2654
IF TG_OP = 'INSERT' THEN
2655
IF NEW.owner is NULL THEN
2656
UPDATE QuestionMessage
2657
SET owner = Message.owner FROM
2659
Message.id = NEW.message AND
2660
QuestionMessage.id = NEW.id;
2662
ELSIF NEW.message != OLD.message THEN
2663
UPDATE QuestionMessage
2664
SET owner = Message.owner FROM
2666
Message.id = NEW.message AND
2667
QuestionMessage.id = NEW.id;
2669
RETURN NULL; -- Ignored - this is an AFTER trigger
2674
COMMENT ON FUNCTION questionmessage_copy_owner_from_message() IS 'Copies the message owner into QuestionMessage when QuestionMessage changes.';
2677
CREATE FUNCTION replication_lag() RETURNS interval
2678
LANGUAGE plpgsql STABLE SECURITY DEFINER
2679
SET search_path TO public
2684
SELECT INTO v_lag max(st_lag_time) FROM _sl.sl_status;
2686
-- Slony-I not installed here - non-replicated setup.
2688
WHEN invalid_schema_name THEN
2690
WHEN undefined_table THEN
2696
COMMENT ON FUNCTION replication_lag() IS 'Returns the worst lag time in our cluster, or NULL if not a replicated installation. Only returns meaningful results on the lpmain replication set master.';
2699
CREATE FUNCTION replication_lag(node_id integer) RETURNS interval
2700
LANGUAGE plpgsql STABLE SECURITY DEFINER
2701
SET search_path TO public
2706
SELECT INTO v_lag st_lag_time FROM _sl.sl_status
2707
WHERE st_origin = _sl.getlocalnodeid('_sl')
2708
AND st_received = node_id;
2710
-- Slony-I not installed here - non-replicated setup.
2712
WHEN invalid_schema_name THEN
2714
WHEN undefined_table THEN
2720
COMMENT ON FUNCTION replication_lag(node_id integer) IS 'Returns the lag time of the lpmain replication set to the given node, or NULL if not a replicated installation. The node id parameter can be obtained by calling getlocalnodeid() on the relevant database. This function only returns meaningful results on the lpmain replication set master.';
2723
CREATE FUNCTION sane_version(text) RETURNS boolean
2724
LANGUAGE plpythonu IMMUTABLE STRICT
2727
if re.search("""^(?ix)
2729
( [0-9a-z] | [0-9a-z.-]*[0-9a-z] )*
2736
COMMENT ON FUNCTION sane_version(text) IS 'A sane version number for use by ProductRelease and DistroRelease. We may make it less strict if required, but it would be nice if we can enforce simple version strings because we use them in URLs';
2739
CREATE FUNCTION set_bug_date_last_message() RETURNS trigger
2740
LANGUAGE plpgsql SECURITY DEFINER
2741
SET search_path TO public
2744
IF TG_OP = 'INSERT' THEN
2746
SET date_last_message = CURRENT_TIMESTAMP AT TIME ZONE 'UTC'
2747
WHERE Bug.id = NEW.bug;
2750
SET date_last_message = max_datecreated
2752
SELECT BugMessage.bug, max(Message.datecreated) AS max_datecreated
2753
FROM BugMessage, Message
2754
WHERE BugMessage.id <> OLD.id
2755
AND BugMessage.bug = OLD.bug
2756
AND BugMessage.message = Message.id
2757
GROUP BY BugMessage.bug
2759
WHERE Bug.id = MessageSummary.bug;
2761
RETURN NULL; -- Ignored - this is an AFTER trigger
2766
COMMENT ON FUNCTION set_bug_date_last_message() IS 'AFTER INSERT trigger on BugMessage maintaining the Bug.date_last_message column';
2769
CREATE FUNCTION set_bug_message_count() RETURNS trigger
2773
IF TG_OP = 'UPDATE' THEN
2774
IF NEW.bug = OLD.bug THEN
2775
RETURN NULL; -- Ignored - this is an AFTER trigger.
2779
IF TG_OP <> 'DELETE' THEN
2780
UPDATE Bug SET message_count = message_count + 1
2781
WHERE Bug.id = NEW.bug;
2784
IF TG_OP <> 'INSERT' THEN
2785
UPDATE Bug SET message_count = message_count - 1
2786
WHERE Bug.id = OLD.bug;
2789
RETURN NULL; -- Ignored - this is an AFTER trigger.
2794
COMMENT ON FUNCTION set_bug_message_count() IS 'AFTER UPDATE trigger on BugAffectsPerson maintaining the Bug.users_affected_count column';
2797
CREATE FUNCTION set_bug_number_of_duplicates() RETURNS trigger
2801
-- Short circuit on an update that doesn't change duplicateof
2802
IF TG_OP = 'UPDATE' THEN
2803
IF NEW.duplicateof = OLD.duplicateof THEN
2804
RETURN NULL; -- Ignored - this is an AFTER trigger
2808
-- For update or delete, possibly decrement a bug's dupe count
2809
IF TG_OP <> 'INSERT' THEN
2810
IF OLD.duplicateof IS NOT NULL THEN
2811
UPDATE Bug SET number_of_duplicates = number_of_duplicates - 1
2812
WHERE Bug.id = OLD.duplicateof;
2816
-- For update or insert, possibly increment a bug's dupe cout
2817
IF TG_OP <> 'DELETE' THEN
2818
IF NEW.duplicateof IS NOT NULL THEN
2819
UPDATE Bug SET number_of_duplicates = number_of_duplicates + 1
2820
WHERE Bug.id = NEW.duplicateof;
2824
RETURN NULL; -- Ignored - this is an AFTER trigger
2829
COMMENT ON FUNCTION set_bug_number_of_duplicates() IS 'AFTER UPDATE trigger on Bug maintaining the Bug.number_of_duplicates column';
2832
CREATE FUNCTION set_bug_users_affected_count() RETURNS trigger
2836
IF TG_OP = 'INSERT' THEN
2837
IF NEW.affected = TRUE THEN
2839
SET users_affected_count = users_affected_count + 1
2840
WHERE Bug.id = NEW.bug;
2843
SET users_unaffected_count = users_unaffected_count + 1
2844
WHERE Bug.id = NEW.bug;
2848
IF TG_OP = 'DELETE' THEN
2849
IF OLD.affected = TRUE THEN
2851
SET users_affected_count = users_affected_count - 1
2852
WHERE Bug.id = OLD.bug;
2855
SET users_unaffected_count = users_unaffected_count - 1
2856
WHERE Bug.id = OLD.bug;
2860
IF TG_OP = 'UPDATE' THEN
2861
IF OLD.affected <> NEW.affected THEN
2862
IF NEW.affected THEN
2864
SET users_affected_count = users_affected_count + 1,
2865
users_unaffected_count = users_unaffected_count - 1
2866
WHERE Bug.id = OLD.bug;
2869
SET users_affected_count = users_affected_count - 1,
2870
users_unaffected_count = users_unaffected_count + 1
2871
WHERE Bug.id = OLD.bug;
2881
CREATE FUNCTION set_bugtask_date_milestone_set() RETURNS trigger
2885
IF TG_OP = 'INSERT' THEN
2886
-- If the inserted row as a milestone set, set date_milestone_set.
2887
IF NEW.milestone IS NOT NULL THEN
2889
SET date_milestone_set = CURRENT_TIMESTAMP AT TIME ZONE 'UTC'
2890
WHERE BugTask.id = NEW.id;
2894
IF TG_OP = 'UPDATE' THEN
2895
IF OLD.milestone IS NULL THEN
2896
-- If there was no milestone set, check if the new row has a
2897
-- milestone set and set date_milestone_set.
2898
IF NEW.milestone IS NOT NULL THEN
2900
SET date_milestone_set = CURRENT_TIMESTAMP AT TIME ZONE 'UTC'
2901
WHERE BugTask.id = NEW.id;
2904
IF NEW.milestone IS NULL THEN
2905
-- If the milestone was unset, clear date_milestone_set.
2907
SET date_milestone_set = NULL
2908
WHERE BugTask.id = NEW.id;
2910
-- Update date_milestone_set if the bug task was
2911
-- targeted to another milestone.
2912
IF NEW.milestone != OLD.milestone THEN
2914
SET date_milestone_set = CURRENT_TIMESTAMP AT TIME ZONE 'UTC'
2915
WHERE BugTask.id = NEW.id;
2922
RETURN NULL; -- Ignored - this is an AFTER trigger.
2927
COMMENT ON FUNCTION set_bugtask_date_milestone_set() IS 'Update BugTask.date_milestone_set when BugTask.milestone is changed.';
2930
CREATE FUNCTION set_date_status_set() RETURNS trigger
2934
IF OLD.status <> NEW.status THEN
2935
NEW.date_status_set = CURRENT_TIMESTAMP AT TIME ZONE 'UTC';
2942
COMMENT ON FUNCTION set_date_status_set() IS 'BEFORE UPDATE trigger on Account that maintains the Account.date_status_set column.';
2945
CREATE FUNCTION set_openid_identifier() RETURNS trigger
2948
# If someone is trying to explicitly set the openid_identifier, let them.
2949
# This also causes openid_identifiers to be left alone if this is an
2951
if TD['new']['openid_identifier'] is not None:
2954
from random import choice
2956
# Non display confusing characters
2957
chars = '34678bcdefhkmnprstwxyzABCDEFGHJKLMNPQRTWXY'
2959
# character length of tokens. Can be increased, decreased or even made
2960
# random - Launchpad does not care. 7 means it takes 40 bytes to store
2961
# a null-terminated Launchpad identity URL on the current domain name.
2965
while loop_count < 20000:
2966
# Generate a random openid_identifier
2967
oid = ''.join(choice(chars) for count in range(length))
2969
# Check if the oid is already in the db, although this is pretty
2971
rv = plpy.execute("""
2972
SELECT COUNT(*) AS num FROM Person WHERE openid_identifier = '%s'
2974
if rv[0]['num'] == 0:
2975
TD['new']['openid_identifier'] = oid
2980
'Clash generating unique openid_identifier. '
2981
'Increase length if you see this warning too much.')
2983
"Unable to generate unique openid_identifier. "
2984
"Need to increase length of tokens.")
2988
CREATE FUNCTION set_shipit_normalized_address() RETURNS trigger
2992
NEW.normalized_address =
2994
-- Strip off everything that's not alphanumeric
2997
coalesce(NEW.addressline1, '') || ' ' ||
2998
coalesce(NEW.addressline2, '') || ' ' ||
2999
coalesce(NEW.city, ''),
3000
'[^a-zA-Z0-9]+', '', 'g'));
3006
COMMENT ON FUNCTION set_shipit_normalized_address() IS 'Store a normalized concatenation of the request''s address into the normalized_address column.';
3009
CREATE FUNCTION sha1(text) RETURNS character
3010
LANGUAGE plpythonu IMMUTABLE STRICT
3013
return hashlib.sha1(args[0]).hexdigest()
3017
COMMENT ON FUNCTION sha1(text) IS 'Return the SHA1 one way cryptographic hash as a string of 40 hex digits';
3020
CREATE FUNCTION summarise_bug(bug_row bug) RETURNS void
3024
d bugsummary%ROWTYPE;
3026
PERFORM ensure_bugsummary_temp_journal();
3027
FOR d IN SELECT * FROM bugsummary_locations(BUG_ROW) LOOP
3029
PERFORM bug_summary_temp_journal_ins(d);
3035
COMMENT ON FUNCTION summarise_bug(bug_row bug) IS 'AFTER summarise a bug row into bugsummary.';
3038
CREATE FUNCTION ulower(text) RETURNS text
3039
LANGUAGE plpythonu IMMUTABLE STRICT
3041
return args[0].decode('utf8').lower().encode('utf8')
3045
COMMENT ON FUNCTION ulower(text) IS 'Return the lower case version of a UTF-8 encoded string.';
3048
CREATE FUNCTION unsummarise_bug(bug_row bug) RETURNS void
3052
d bugsummary%ROWTYPE;
3054
PERFORM ensure_bugsummary_temp_journal();
3055
FOR d IN SELECT * FROM bugsummary_locations(BUG_ROW) LOOP
3057
PERFORM bug_summary_temp_journal_ins(d);
3063
COMMENT ON FUNCTION unsummarise_bug(bug_row bug) IS 'AFTER unsummarise a bug row from bugsummary.';
3066
CREATE FUNCTION update_branch_name_cache() RETURNS trigger
3070
needs_update boolean := FALSE;
3072
IF TG_OP = 'INSERT' THEN
3073
needs_update := TRUE;
3074
ELSIF (NEW.owner_name IS NULL
3075
OR NEW.unique_name IS NULL
3076
OR OLD.owner_name <> NEW.owner_name
3077
OR OLD.unique_name <> NEW.unique_name
3078
OR (NEW.target_suffix IS NULL <> OLD.target_suffix IS NULL)
3079
OR COALESCE(OLD.target_suffix, '') <> COALESCE(NEW.target_suffix, '')
3080
OR OLD.name <> NEW.name
3081
OR OLD.owner <> NEW.owner
3082
OR COALESCE(OLD.product, -1) <> COALESCE(NEW.product, -1)
3083
OR COALESCE(OLD.distroseries, -1) <> COALESCE(NEW.distroseries, -1)
3084
OR COALESCE(OLD.sourcepackagename, -1)
3085
<> COALESCE(NEW.sourcepackagename, -1)) THEN
3086
needs_update := TRUE;
3089
IF needs_update THEN
3091
Person.name AS owner_name,
3092
COALESCE(Product.name, SPN.name) AS target_suffix,
3093
'~' || Person.name || '/' || COALESCE(
3095
Distribution.name || '/' || Distroseries.name
3097
'+junk') || '/' || NEW.name AS unique_name
3098
INTO NEW.owner_name, NEW.target_suffix, NEW.unique_name
3100
LEFT OUTER JOIN DistroSeries ON NEW.distroseries = DistroSeries.id
3101
LEFT OUTER JOIN Product ON NEW.product = Product.id
3102
LEFT OUTER JOIN Distribution
3103
ON Distroseries.distribution = Distribution.id
3104
LEFT OUTER JOIN SourcepackageName AS SPN
3105
ON SPN.id = NEW.sourcepackagename
3106
WHERE Person.id = NEW.owner;
3114
COMMENT ON FUNCTION update_branch_name_cache() IS 'Maintain the cached name columns in Branch.';
3117
CREATE FUNCTION update_database_disk_utilization() RETURNS void
3118
LANGUAGE sql SECURITY DEFINER
3119
SET search_path TO public
3121
INSERT INTO DatabaseDiskUtilization
3123
CURRENT_TIMESTAMP AT TIME ZONE 'UTC',
3125
sub_namespace, sub_name,
3127
(namespace || '.' || name || COALESCE(
3128
'/' || sub_namespace || '.' || sub_name, '')) AS sort,
3132
(stat).tuple_percent,
3133
(stat).dead_tuple_count,
3134
(stat).dead_tuple_len,
3135
(stat).dead_tuple_percent,
3140
pg_namespace.nspname AS namespace,
3141
pg_class.relname AS name,
3142
NULL AS sub_namespace,
3144
pg_class.relkind AS kind,
3145
pgstattuple(pg_class.oid) AS stat
3146
FROM pg_class, pg_namespace
3148
pg_class.relnamespace = pg_namespace.oid
3149
AND pg_class.relkind = 'r'
3150
AND pg_table_is_visible(pg_class.oid)
3155
pg_namespace_table.nspname AS namespace,
3156
pg_class_table.relname AS name,
3157
pg_namespace_index.nspname AS sub_namespace,
3158
pg_class_index.relname AS sub_name,
3159
pg_class_index.relkind AS kind,
3160
pgstattuple(pg_class_index.oid) AS stat
3162
pg_namespace AS pg_namespace_table,
3163
pg_namespace AS pg_namespace_index,
3164
pg_class AS pg_class_table,
3165
pg_class AS pg_class_index,
3168
pg_class_index.relkind = 'i'
3169
AND pg_table_is_visible(pg_class_table.oid)
3170
AND pg_class_index.relnamespace = pg_namespace_index.oid
3171
AND pg_class_table.relnamespace = pg_namespace_table.oid
3172
AND pg_index.indexrelid = pg_class_index.oid
3173
AND pg_index.indrelid = pg_class_table.oid
3179
pg_namespace_table.nspname AS namespace,
3180
pg_class_table.relname AS name,
3181
pg_namespace_toast.nspname AS sub_namespace,
3182
pg_class_toast.relname AS sub_name,
3183
pg_class_toast.relkind AS kind,
3184
pgstattuple(pg_class_toast.oid) AS stat
3186
pg_namespace AS pg_namespace_table,
3187
pg_namespace AS pg_namespace_toast,
3188
pg_class AS pg_class_table,
3189
pg_class AS pg_class_toast
3191
pg_class_toast.relnamespace = pg_namespace_toast.oid
3192
AND pg_table_is_visible(pg_class_table.oid)
3193
AND pg_class_table.relnamespace = pg_namespace_table.oid
3194
AND pg_class_toast.oid = pg_class_table.reltoastrelid
3200
pg_namespace_table.nspname AS namespace,
3201
pg_class_table.relname AS name,
3202
pg_namespace_index.nspname AS sub_namespace,
3203
pg_class_index.relname AS sub_name,
3204
pg_class_index.relkind AS kind,
3205
pgstattuple(pg_class_index.oid) AS stat
3207
pg_namespace AS pg_namespace_table,
3208
pg_namespace AS pg_namespace_index,
3209
pg_class AS pg_class_table,
3210
pg_class AS pg_class_index,
3211
pg_class AS pg_class_toast
3213
pg_class_table.relnamespace = pg_namespace_table.oid
3214
AND pg_table_is_visible(pg_class_table.oid)
3215
AND pg_class_index.relnamespace = pg_namespace_index.oid
3216
AND pg_class_table.reltoastrelid = pg_class_toast.oid
3217
AND pg_class_index.oid = pg_class_toast.reltoastidxid
3222
CREATE FUNCTION update_database_stats() RETURNS void
3223
LANGUAGE plpythonu SECURITY DEFINER
3224
SET search_path TO public
3229
# Prune DatabaseTableStats and insert current data.
3230
# First, detect if the statistics have been reset.
3231
stats_reset = plpy.execute("""
3234
pg_catalog.pg_stat_user_tables AS NowStat,
3235
DatabaseTableStats AS LastStat
3237
LastStat.date_created = (
3238
SELECT max(date_created) FROM DatabaseTableStats)
3239
AND NowStat.schemaname = LastStat.schemaname
3240
AND NowStat.relname = LastStat.relname
3242
NowStat.seq_scan < LastStat.seq_scan
3243
OR NowStat.idx_scan < LastStat.idx_scan
3244
OR NowStat.n_tup_ins < LastStat.n_tup_ins
3245
OR NowStat.n_tup_upd < LastStat.n_tup_upd
3246
OR NowStat.n_tup_del < LastStat.n_tup_del
3247
OR NowStat.n_tup_hot_upd < LastStat.n_tup_hot_upd)
3251
# The database stats have been reset. We cannot calculate
3252
# deltas because we do not know when this happened. So we trash
3253
# our records as they are now useless to us. We could be more
3254
# sophisticated about this, but this should only happen
3255
# when an admin explicitly resets the statistics or if the
3256
# database is rebuilt.
3257
plpy.notice("Stats wraparound. Purging DatabaseTableStats")
3258
plpy.execute("DELETE FROM DatabaseTableStats")
3261
DELETE FROM DatabaseTableStats
3262
WHERE date_created < (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'
3263
- CAST('21 days' AS interval));
3265
# Insert current data.
3267
INSERT INTO DatabaseTableStats
3269
CURRENT_TIMESTAMP AT TIME ZONE 'UTC',
3270
schemaname, relname, seq_scan, seq_tup_read,
3271
coalesce(idx_scan, 0), coalesce(idx_tup_fetch, 0),
3272
n_tup_ins, n_tup_upd, n_tup_del,
3273
n_tup_hot_upd, n_live_tup, n_dead_tup, last_vacuum,
3274
last_autovacuum, last_analyze, last_autoanalyze
3275
FROM pg_catalog.pg_stat_user_tables;
3278
# Prune DatabaseCpuStats. Calculate CPU utilization information
3279
# and insert current data.
3281
DELETE FROM DatabaseCpuStats
3282
WHERE date_created < (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'
3283
- CAST('21 days' AS interval));
3285
dbname = plpy.execute(
3286
"SELECT current_database() AS dbname", 1)[0]['dbname']
3287
ps = subprocess.Popen(
3288
["ps", "-C", "postgres", "--no-headers", "-o", "cp,args"],
3289
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
3290
stderr=subprocess.STDOUT)
3291
stdout, stderr = ps.communicate()
3293
# We make the username match non-greedy so the trailing \d eats
3294
# trailing digits from the database username. This collapses
3295
# lpnet1, lpnet2 etc. into just lpnet.
3297
r"(?m)^\s*(\d+)\spostgres:\s(\w+?)\d*\s%s\s" % dbname)
3298
for ps_match in ps_re.finditer(stdout):
3299
cpu, username = ps_match.groups()
3300
cpus[username] = int(cpu) + cpus.setdefault(username, 0)
3301
cpu_ins = plpy.prepare(
3302
"INSERT INTO DatabaseCpuStats (username, cpu) VALUES ($1, $2)",
3303
["text", "integer"])
3304
for cpu_tuple in cpus.items():
3305
plpy.execute(cpu_ins, cpu_tuple)
3309
COMMENT ON FUNCTION update_database_stats() IS 'Copies rows from pg_stat_user_tables into DatabaseTableStats. We use a stored procedure because it is problematic for us to grant permissions on objects in the pg_catalog schema.';
3312
CREATE FUNCTION update_replication_lag_cache() RETURNS boolean
3313
LANGUAGE plpgsql SECURITY DEFINER
3314
SET search_path TO public
3317
DELETE FROM DatabaseReplicationLag;
3318
INSERT INTO DatabaseReplicationLag (node, lag)
3319
SELECT st_received, st_lag_time FROM _sl.sl_status
3320
WHERE st_origin = _sl.getlocalnodeid('_sl');
3322
-- Slony-I not installed here - non-replicated setup.
3324
WHEN invalid_schema_name THEN
3326
WHEN undefined_table THEN
3332
COMMENT ON FUNCTION update_replication_lag_cache() IS 'Updates the DatabaseReplicationLag materialized view.';
3335
CREATE FUNCTION update_transitively_private(start_branch integer, _root_branch integer DEFAULT NULL::integer, _root_transitively_private boolean DEFAULT NULL::boolean) RETURNS void
3336
LANGUAGE plpgsql SECURITY DEFINER
3337
SET search_path TO public
3340
root_transitively_private boolean := _root_transitively_private;
3341
root_branch int := _root_branch;
3343
IF root_transitively_private IS NULL THEN
3344
-- We can't just trust the transitively_private flag of the
3345
-- branch we are stacked on, as if we are updating multiple
3346
-- records they will be updated in an indeterminate order.
3347
-- We need a recursive query.
3348
UPDATE Branch SET transitively_private = (
3349
WITH RECURSIVE stacked_branches AS (
3351
top_branch.id, top_branch.stacked_on, top_branch.private
3352
FROM Branch AS top_branch
3353
WHERE top_branch.id = start_branch
3356
sub_branch.id, sub_branch.stacked_on, sub_branch.private
3357
FROM stacked_branches, Branch AS sub_branch
3359
stacked_branches.stacked_on = sub_branch.id
3360
AND stacked_branches.stacked_on != start_branch
3361
-- Shortcircuit. No need to recurse if already private.
3362
AND stacked_branches.private IS FALSE
3365
FROM stacked_branches
3366
WHERE private IS TRUE)
3367
WHERE Branch.id = start_branch
3368
RETURNING transitively_private INTO root_transitively_private;
3369
root_branch := start_branch;
3371
-- Now we have calculated the correct transitively_private flag
3374
transitively_private = GREATEST(private, root_transitively_private)
3375
WHERE id = root_branch;
3378
-- Recurse to branches stacked on this one.
3379
PERFORM update_transitively_private(
3380
start_branch, id, GREATEST(private, root_transitively_private))
3381
FROM Branch WHERE stacked_on = root_branch AND id != start_branch;
3386
COMMENT ON FUNCTION update_transitively_private(start_branch integer, _root_branch integer, _root_transitively_private boolean) IS 'A branch is transitively private if it is private or is stacked on any transitively private branches.';
3389
CREATE FUNCTION valid_absolute_url(text) RETURNS boolean
3390
LANGUAGE plpythonu IMMUTABLE STRICT
3392
from urlparse import urlparse, uses_netloc
3393
# Extend list of schemes that specify netloc. We can drop sftp
3394
# with Python 2.5 in the DB.
3395
if 'git' not in uses_netloc:
3396
uses_netloc.insert(0, 'sftp')
3397
uses_netloc.insert(0, 'bzr')
3398
uses_netloc.insert(0, 'bzr+ssh')
3399
uses_netloc.insert(0, 'ssh') # Mercurial
3400
uses_netloc.insert(0, 'git')
3401
(scheme, netloc, path, params, query, fragment) = urlparse(args[0])
3402
return bool(scheme and netloc)
3406
COMMENT ON FUNCTION valid_absolute_url(text) IS 'Ensure the given test is a valid absolute URL, containing both protocol and network location';
3409
CREATE FUNCTION valid_branch_name(text) RETURNS boolean
3410
LANGUAGE plpythonu IMMUTABLE STRICT
3414
pat = r"^(?i)[a-z0-9][a-z0-9+\.\-@_]*\Z"
3415
if re.match(pat, name):
3421
COMMENT ON FUNCTION valid_branch_name(text) IS 'validate a branch name.
3423
As per valid_name, except we allow uppercase and @';
3426
CREATE FUNCTION valid_cve(text) RETURNS boolean
3427
LANGUAGE plpythonu IMMUTABLE STRICT
3431
pat = r"^(19|20)\d{2}-\d{4}$"
3432
if re.match(pat, name):
3438
COMMENT ON FUNCTION valid_cve(text) IS 'validate a common vulnerability number as defined on www.cve.mitre.org, minus the CAN- or CVE- prefix.';
3441
CREATE FUNCTION valid_debian_version(text) RETURNS boolean
3442
LANGUAGE plpythonu IMMUTABLE STRICT
3445
m = re.search("""^(?ix)
3447
([0-9a-z][a-z0-9+:.~-]*?)
3452
epoch, version, revision = m.groups()
3454
# Can''t contain : if no epoch
3458
# Can''t contain - if no revision
3465
COMMENT ON FUNCTION valid_debian_version(text) IS 'validate a version number as per Debian Policy';
3468
CREATE FUNCTION valid_fingerprint(text) RETURNS boolean
3469
LANGUAGE plpythonu IMMUTABLE STRICT
3472
if re.match(r"[\dA-F]{40}", args[0]) is not None:
3479
COMMENT ON FUNCTION valid_fingerprint(text) IS 'Returns true if passed a valid GPG fingerprint. Valid GPG fingerprints are a 40 character long hexadecimal number in uppercase.';
3482
CREATE FUNCTION valid_keyid(text) RETURNS boolean
3483
LANGUAGE plpythonu IMMUTABLE STRICT
3486
if re.match(r"[\dA-F]{8}", args[0]) is not None:
3493
COMMENT ON FUNCTION valid_keyid(text) IS 'Returns true if passed a valid GPG keyid. Valid GPG keyids are an 8 character long hexadecimal number in uppercase (in reality, they are 16 characters long but we are using the ''common'' definition.';
3496
CREATE FUNCTION valid_regexp(text) RETURNS boolean
3497
LANGUAGE plpythonu IMMUTABLE STRICT
3509
COMMENT ON FUNCTION valid_regexp(text) IS 'Returns true if the input can be compiled as a regular expression.';
3512
CREATE FUNCTION version_sort_key(version text) RETURNS text
3513
LANGUAGE plpythonu IMMUTABLE STRICT
3515
# If this method is altered, then any functional indexes using it
3516
# need to be rebuilt.
3521
def substitute_filled_numbers(match):
3522
# Prepend "~" so that version numbers will show up first
3523
# when sorted descending, i.e. [3, 2c, 2b, 1, c, b, a] instead
3524
# of [c, b, a, 3, 2c, 2b, 1]. "~" has the highest ASCII value
3525
# of visible ASCII characters.
3526
return '~' + match.group(0).zfill(5)
3528
return re.sub(u'\d+', substitute_filled_numbers, version)
3532
COMMENT ON FUNCTION version_sort_key(version text) IS 'Sort a field as version numbers that do not necessarily conform to debian package versions (For example, when "2-2" should be considered greater than "1:1"). debversion_sort_key() should be used for debian versions. Numbers will be sorted after letters unlike typical ASCII, so that a descending sort will put the latest version number that starts with a number instead of a letter will be at the top. E.g. ascending is [a, z, 1, 9] and descending is [9, 1, z, a].';
3535
CREATE FUNCTION you_are_your_own_member() RETURNS trigger
3539
INSERT INTO TeamParticipation (person, team)
3540
VALUES (NEW.id, NEW.id);
3546
COMMENT ON FUNCTION you_are_your_own_member() IS 'Trigger function to ensure that every row added to the Person table gets a corresponding row in the TeamParticipation table, as per the TeamParticipationUsage page on the Launchpad wiki';
3549
SET search_path = ts2, pg_catalog;
3551
CREATE FUNCTION _ftq(text) RETURNS text
3552
LANGUAGE plpythonu IMMUTABLE STRICT
3556
# I think this method would be more robust if we used a real
3557
# tokenizer and parser to generate the query string, but we need
3558
# something suitable for use as a stored procedure which currently
3559
# means no external dependancies.
3561
# Convert to Unicode
3562
query = args[0].decode('utf8')
3563
## plpy.debug('1 query is %s' % repr(query))
3565
# Normalize whitespace
3566
query = re.sub("(?u)\s+"," ", query)
3568
# Convert AND, OR, NOT and - to tsearch2 punctuation
3569
query = re.sub(r"(?u)(?:^|\s)-([\w\(])", r" !\1", query)
3570
query = re.sub(r"(?u)\bAND\b", "&", query)
3571
query = re.sub(r"(?u)\bOR\b", "|", query)
3572
query = re.sub(r"(?u)\bNOT\b", " !", query)
3573
## plpy.debug('2 query is %s' % repr(query))
3575
# Deal with unwanted punctuation. We convert strings of punctuation
3576
# inside words to a '-' character for the hypenation handling below
3577
# to deal with further. Outside of words we replace with whitespace.
3578
# We don't mess with -&|!()' as they are handled later.
3579
#punctuation = re.escape(r'`~@#$%^*+=[]{}:;"<>,.?\/')
3580
punctuation = r"[^\w\s\-\&\|\!\(\)']"
3581
query = re.sub(r"(?u)(\w)%s+(\w)" % (punctuation,), r"\1-\2", query)
3582
query = re.sub(r"(?u)%s+" % (punctuation,), " ", query)
3583
## plpy.debug('3 query is %s' % repr(query))
3585
# Strip ! characters inside and at the end of a word
3586
query = re.sub(r"(?u)(?<=\w)[\!]+", " ", query)
3588
# Now that we have handle case sensitive booleans, convert to lowercase
3589
query = query.lower()
3591
# Convert foo-bar to ((foo&bar)|foobar) and foo-bar-baz to
3592
# ((foo&bar&baz)|foobarbaz)
3593
def hyphen_repl(match):
3594
bits = match.group(0).split("-")
3595
return "((%s)|%s)" % ("&".join(bits), "".join(bits))
3596
query = re.sub(r"(?u)\b\w+-[\w\-]+\b", hyphen_repl, query)
3597
## plpy.debug('4 query is %s' % repr(query))
3599
# Any remaining - characters are spurious
3600
query = query.replace('-','')
3602
# Remove unpartnered bracket on the left and right
3603
query = re.sub(r"(?ux) ^ ( [^(]* ) \)", r"(\1)", query)
3604
query = re.sub(r"(?ux) \( ( [^)]* ) $", r"(\1)", query)
3606
# Remove spurious brackets
3607
query = re.sub(r"(?u)\(([^\&\|]*?)\)", r" \1 ", query)
3608
## plpy.debug('5 query is %s' % repr(query))
3610
# Insert & between tokens without an existing boolean operator
3611
# ( not proceeded by (|&!
3612
query = re.sub(r"(?u)(?<![\(\|\&\!])\s*\(", "&(", query)
3613
## plpy.debug('6 query is %s' % repr(query))
3614
# ) not followed by )|&
3615
query = re.sub(r"(?u)\)(?!\s*(\)|\||\&|\s*$))", ")&", query)
3616
## plpy.debug('6.1 query is %s' % repr(query))
3617
# Whitespace not proceded by (|&! not followed by &|
3618
query = re.sub(r"(?u)(?<![\(\|\&\!\s])\s+(?![\&\|\s])", "&", query)
3619
## plpy.debug('7 query is %s' % repr(query))
3621
# Detect and repair syntax errors - we are lenient because
3622
# this input is generally from users.
3624
# Fix unbalanced brackets
3625
openings = query.count("(")
3626
closings = query.count(")")
3627
if openings > closings:
3628
query = query + " ) "*(openings-closings)
3629
elif closings > openings:
3630
query = " ( "*(closings-openings) + query
3631
## plpy.debug('8 query is %s' % repr(query))
3633
# Strip ' character that do not have letters on both sides
3634
query = re.sub(r"(?u)((?<!\w)'|'(?!\w))", "", query)
3636
# Brackets containing nothing but whitespace and booleans, recursive
3638
while last != query:
3640
query = re.sub(r"(?u)\([\s\&\|\!]*\)", "", query)
3641
## plpy.debug('9 query is %s' % repr(query))
3643
# An & or | following a (
3644
query = re.sub(r"(?u)(?<=\()[\&\|\s]+", "", query)
3645
## plpy.debug('10 query is %s' % repr(query))
3647
# An &, | or ! immediatly before a )
3648
query = re.sub(r"(?u)[\&\|\!\s]*[\&\|\!]+\s*(?=\))", "", query)
3649
## plpy.debug('11 query is %s' % repr(query))
3651
# An &,| or ! followed by another boolean.
3652
query = re.sub(r"(?ux) \s* ( [\&\|\!] ) [\s\&\|]+", r"\1", query)
3653
## plpy.debug('12 query is %s' % repr(query))
3656
query = re.sub(r"(?u)^[\s\&\|]+", "", query)
3657
## plpy.debug('13 query is %s' % repr(query))
3659
# Trailing &, | or !
3660
query = re.sub(r"(?u)[\&\|\!\s]+$", "", query)
3661
## plpy.debug('14 query is %s' % repr(query))
3663
# If we have nothing but whitespace and tsearch2 operators,
3665
if re.search(r"(?u)^[\&\|\!\s\(\)]*$", query) is not None:
3668
# Convert back to UTF-8
3669
query = query.encode('utf8')
3670
## plpy.debug('15 query is %s' % repr(query))
3672
return query or None
3676
CREATE FUNCTION _get_parser_from_curcfg() RETURNS text
3677
LANGUAGE sql IMMUTABLE STRICT
3678
AS $$select prsname::text from pg_catalog.pg_ts_parser p join pg_ts_config c on cfgparser = p.oid where c.oid = show_curcfg();$$;
3681
CREATE FUNCTION concat(pg_catalog.tsvector, pg_catalog.tsvector) RETURNS pg_catalog.tsvector
3682
LANGUAGE internal IMMUTABLE STRICT
3683
AS $$tsvector_concat$$;
3686
CREATE FUNCTION dex_init(internal) RETURNS internal
3688
AS '$libdir/tsearch2', 'tsa_dex_init';
3691
CREATE FUNCTION dex_lexize(internal, internal, integer) RETURNS internal
3693
AS '$libdir/tsearch2', 'tsa_dex_lexize';
3696
CREATE FUNCTION ftiupdate() RETURNS trigger
3700
args = TD["args"][:]
3702
# Short circuit if none of the relevant columns have been
3703
# modified and fti is not being set to NULL (setting the fti
3704
# column to NULL is thus how we can force a rebuild of the fti
3706
if TD["event"] == "UPDATE" and new["fti"] != None:
3708
relevant_modification = False
3709
for column_name in args[::2]:
3710
if new[column_name] != old[column_name]:
3711
relevant_modification = True
3713
if not relevant_modification:
3716
# Generate an SQL statement that turns the requested
3717
# column values into a weighted tsvector
3719
for i in range(0, len(args), 2):
3721
"ts2.setweight(ts2.to_tsvector('default', coalesce("
3722
"substring(ltrim($%d) from 1 for 2500),'')),"
3723
"CAST($%d AS \"char\"))" % (i + 1, i + 2))
3724
args[i] = new[args[i]]
3726
sql = "SELECT %s AS fti" % "||".join(sql)
3728
# Execute and store in the fti column
3729
plan = plpy.prepare(sql, ["text", "char"] * (len(args)/2))
3730
new["fti"] = plpy.execute(plan, args, 1)[0]["fti"]
3732
# Tell PostgreSQL we have modified the data
3737
COMMENT ON FUNCTION ftiupdate() IS 'Trigger function that keeps the fti tsvector column up to date.';
3740
CREATE FUNCTION ftq(text) RETURNS pg_catalog.tsquery
3741
LANGUAGE plpythonu IMMUTABLE STRICT
3745
# I think this method would be more robust if we used a real
3746
# tokenizer and parser to generate the query string, but we need
3747
# something suitable for use as a stored procedure which currently
3748
# means no external dependancies.
3750
# Convert to Unicode
3751
query = args[0].decode('utf8')
3752
## plpy.debug('1 query is %s' % repr(query))
3754
# Normalize whitespace
3755
query = re.sub("(?u)\s+"," ", query)
3757
# Convert AND, OR, NOT and - to tsearch2 punctuation
3758
query = re.sub(r"(?u)(?:^|\s)-([\w\(])", r" !\1", query)
3759
query = re.sub(r"(?u)\bAND\b", "&", query)
3760
query = re.sub(r"(?u)\bOR\b", "|", query)
3761
query = re.sub(r"(?u)\bNOT\b", " !", query)
3762
## plpy.debug('2 query is %s' % repr(query))
3764
# Deal with unwanted punctuation. We convert strings of punctuation
3765
# inside words to a '-' character for the hypenation handling below
3766
# to deal with further. Outside of words we replace with whitespace.
3767
# We don't mess with -&|!()' as they are handled later.
3768
#punctuation = re.escape(r'`~@#$%^*+=[]{}:;"<>,.?\/')
3769
punctuation = r"[^\w\s\-\&\|\!\(\)']"
3770
query = re.sub(r"(?u)(\w)%s+(\w)" % (punctuation,), r"\1-\2", query)
3771
query = re.sub(r"(?u)%s+" % (punctuation,), " ", query)
3772
## plpy.debug('3 query is %s' % repr(query))
3774
# Strip ! characters inside and at the end of a word
3775
query = re.sub(r"(?u)(?<=\w)[\!]+", " ", query)
3777
# Now that we have handle case sensitive booleans, convert to lowercase
3778
query = query.lower()
3780
# Convert foo-bar to ((foo&bar)|foobar) and foo-bar-baz to
3781
# ((foo&bar&baz)|foobarbaz)
3782
def hyphen_repl(match):
3783
bits = match.group(0).split("-")
3784
return "((%s)|%s)" % ("&".join(bits), "".join(bits))
3785
query = re.sub(r"(?u)\b\w+-[\w\-]+\b", hyphen_repl, query)
3786
## plpy.debug('4 query is %s' % repr(query))
3788
# Any remaining - characters are spurious
3789
query = query.replace('-','')
3791
# Remove unpartnered bracket on the left and right
3792
query = re.sub(r"(?ux) ^ ( [^(]* ) \)", r"(\1)", query)
3793
query = re.sub(r"(?ux) \( ( [^)]* ) $", r"(\1)", query)
3795
# Remove spurious brackets
3796
query = re.sub(r"(?u)\(([^\&\|]*?)\)", r" \1 ", query)
3797
## plpy.debug('5 query is %s' % repr(query))
3799
# Insert & between tokens without an existing boolean operator
3800
# ( not proceeded by (|&!
3801
query = re.sub(r"(?u)(?<![\(\|\&\!])\s*\(", "&(", query)
3802
## plpy.debug('6 query is %s' % repr(query))
3803
# ) not followed by )|&
3804
query = re.sub(r"(?u)\)(?!\s*(\)|\||\&|\s*$))", ")&", query)
3805
## plpy.debug('6.1 query is %s' % repr(query))
3806
# Whitespace not proceded by (|&! not followed by &|
3807
query = re.sub(r"(?u)(?<![\(\|\&\!\s])\s+(?![\&\|\s])", "&", query)
3808
## plpy.debug('7 query is %s' % repr(query))
3810
# Detect and repair syntax errors - we are lenient because
3811
# this input is generally from users.
3813
# Fix unbalanced brackets
3814
openings = query.count("(")
3815
closings = query.count(")")
3816
if openings > closings:
3817
query = query + " ) "*(openings-closings)
3818
elif closings > openings:
3819
query = " ( "*(closings-openings) + query
3820
## plpy.debug('8 query is %s' % repr(query))
3822
# Strip ' character that do not have letters on both sides
3823
query = re.sub(r"(?u)((?<!\w)'|'(?!\w))", "", query)
3825
# Brackets containing nothing but whitespace and booleans, recursive
3827
while last != query:
3829
query = re.sub(r"(?u)\([\s\&\|\!]*\)", "", query)
3830
## plpy.debug('9 query is %s' % repr(query))
3832
# An & or | following a (
3833
query = re.sub(r"(?u)(?<=\()[\&\|\s]+", "", query)
3834
## plpy.debug('10 query is %s' % repr(query))
3836
# An &, | or ! immediatly before a )
3837
query = re.sub(r"(?u)[\&\|\!\s]*[\&\|\!]+\s*(?=\))", "", query)
3838
## plpy.debug('11 query is %s' % repr(query))
3840
# An &,| or ! followed by another boolean.
3841
query = re.sub(r"(?ux) \s* ( [\&\|\!] ) [\s\&\|]+", r"\1", query)
3842
## plpy.debug('12 query is %s' % repr(query))
3845
query = re.sub(r"(?u)^[\s\&\|]+", "", query)
3846
## plpy.debug('13 query is %s' % repr(query))
3848
# Trailing &, | or !
3849
query = re.sub(r"(?u)[\&\|\!\s]+$", "", query)
3850
## plpy.debug('14 query is %s' % repr(query))
3852
# If we have nothing but whitespace and tsearch2 operators,
3854
if re.search(r"(?u)^[\&\|\!\s\(\)]*$", query) is not None:
3857
# Convert back to UTF-8
3858
query = query.encode('utf8')
3859
## plpy.debug('15 query is %s' % repr(query))
3861
p = plpy.prepare("SELECT to_tsquery('default', $1) AS x", ["text"])
3862
query = plpy.execute(p, [query], 1)[0]["x"]
3863
return query or None
3867
COMMENT ON FUNCTION ftq(text) IS 'Convert a string to an unparsed tsearch2 query';
3870
CREATE FUNCTION get_covers(pg_catalog.tsvector, pg_catalog.tsquery) RETURNS text
3872
AS '$libdir/tsearch2', 'tsa_get_covers';
3875
CREATE FUNCTION headline(oid, text, pg_catalog.tsquery, text) RETURNS text
3876
LANGUAGE internal IMMUTABLE STRICT
3877
AS $$ts_headline_byid_opt$$;
3880
CREATE FUNCTION headline(oid, text, pg_catalog.tsquery) RETURNS text
3881
LANGUAGE internal IMMUTABLE STRICT
3882
AS $$ts_headline_byid$$;
3885
CREATE FUNCTION headline(text, text, pg_catalog.tsquery, text) RETURNS text
3886
LANGUAGE c IMMUTABLE STRICT
3887
AS '$libdir/tsearch2', 'tsa_headline_byname';
3890
CREATE FUNCTION headline(text, text, pg_catalog.tsquery) RETURNS text
3891
LANGUAGE c IMMUTABLE STRICT
3892
AS '$libdir/tsearch2', 'tsa_headline_byname';
3895
CREATE FUNCTION headline(text, pg_catalog.tsquery, text) RETURNS text
3896
LANGUAGE internal IMMUTABLE STRICT
3897
AS $$ts_headline_opt$$;
3900
CREATE FUNCTION headline(text, pg_catalog.tsquery) RETURNS text
3901
LANGUAGE internal IMMUTABLE STRICT
3905
CREATE FUNCTION length(pg_catalog.tsvector) RETURNS integer
3906
LANGUAGE internal IMMUTABLE STRICT
3907
AS $$tsvector_length$$;
3910
CREATE FUNCTION lexize(oid, text) RETURNS text[]
3911
LANGUAGE internal STRICT
3915
CREATE FUNCTION lexize(text, text) RETURNS text[]
3917
AS '$libdir/tsearch2', 'tsa_lexize_byname';
3920
CREATE FUNCTION lexize(text) RETURNS text[]
3922
AS '$libdir/tsearch2', 'tsa_lexize_bycurrent';
3925
CREATE FUNCTION numnode(pg_catalog.tsquery) RETURNS integer
3926
LANGUAGE internal IMMUTABLE STRICT
3927
AS $$tsquery_numnode$$;
3930
CREATE FUNCTION parse(oid, text) RETURNS SETOF tokenout
3931
LANGUAGE internal STRICT
3932
AS $$ts_parse_byid$$;
3935
CREATE FUNCTION parse(text, text) RETURNS SETOF tokenout
3936
LANGUAGE internal STRICT
3937
AS $$ts_parse_byname$$;
3940
CREATE FUNCTION parse(text) RETURNS SETOF tokenout
3942
AS '$libdir/tsearch2', 'tsa_parse_current';
3945
CREATE FUNCTION plainto_tsquery(oid, text) RETURNS pg_catalog.tsquery
3946
LANGUAGE internal IMMUTABLE STRICT
3947
AS $$plainto_tsquery_byid$$;
3950
CREATE FUNCTION plainto_tsquery(text, text) RETURNS pg_catalog.tsquery
3951
LANGUAGE c IMMUTABLE STRICT
3952
AS '$libdir/tsearch2', 'tsa_plainto_tsquery_name';
3955
CREATE FUNCTION plainto_tsquery(text) RETURNS pg_catalog.tsquery
3956
LANGUAGE internal IMMUTABLE STRICT
3957
AS $$plainto_tsquery$$;
3960
CREATE FUNCTION prsd_end(internal) RETURNS void
3962
AS '$libdir/tsearch2', 'tsa_prsd_end';
3965
CREATE FUNCTION prsd_getlexeme(internal, internal, internal) RETURNS integer
3967
AS '$libdir/tsearch2', 'tsa_prsd_getlexeme';
3970
CREATE FUNCTION prsd_headline(internal, internal, internal) RETURNS internal
3972
AS '$libdir/tsearch2', 'tsa_prsd_headline';
3975
CREATE FUNCTION prsd_lextype(internal) RETURNS internal
3977
AS '$libdir/tsearch2', 'tsa_prsd_lextype';
3980
CREATE FUNCTION prsd_start(internal, integer) RETURNS internal
3982
AS '$libdir/tsearch2', 'tsa_prsd_start';
3985
CREATE FUNCTION querytree(pg_catalog.tsquery) RETURNS text
3986
LANGUAGE internal STRICT
3990
CREATE FUNCTION rank(real[], pg_catalog.tsvector, pg_catalog.tsquery) RETURNS real
3991
LANGUAGE internal IMMUTABLE STRICT
3995
CREATE FUNCTION rank(real[], pg_catalog.tsvector, pg_catalog.tsquery, integer) RETURNS real
3996
LANGUAGE internal IMMUTABLE STRICT
3997
AS $$ts_rank_wttf$$;
4000
CREATE FUNCTION rank(pg_catalog.tsvector, pg_catalog.tsquery) RETURNS real
4001
LANGUAGE internal IMMUTABLE STRICT
4005
CREATE FUNCTION rank(pg_catalog.tsvector, pg_catalog.tsquery, integer) RETURNS real
4006
LANGUAGE internal IMMUTABLE STRICT
4010
CREATE FUNCTION rank_cd(real[], pg_catalog.tsvector, pg_catalog.tsquery) RETURNS real
4011
LANGUAGE internal IMMUTABLE STRICT
4012
AS $$ts_rankcd_wtt$$;
4015
CREATE FUNCTION rank_cd(real[], pg_catalog.tsvector, pg_catalog.tsquery, integer) RETURNS real
4016
LANGUAGE internal IMMUTABLE STRICT
4017
AS $$ts_rankcd_wttf$$;
4020
CREATE FUNCTION rank_cd(pg_catalog.tsvector, pg_catalog.tsquery) RETURNS real
4021
LANGUAGE internal IMMUTABLE STRICT
4022
AS $$ts_rankcd_tt$$;
4025
CREATE FUNCTION rank_cd(pg_catalog.tsvector, pg_catalog.tsquery, integer) RETURNS real
4026
LANGUAGE internal IMMUTABLE STRICT
4027
AS $$ts_rankcd_ttf$$;
4030
CREATE FUNCTION reset_tsearch() RETURNS void
4032
AS '$libdir/tsearch2', 'tsa_reset_tsearch';
4035
CREATE FUNCTION rewrite(pg_catalog.tsquery, text) RETURNS pg_catalog.tsquery
4036
LANGUAGE internal IMMUTABLE STRICT
4037
AS $$tsquery_rewrite_query$$;
4040
CREATE FUNCTION rewrite(pg_catalog.tsquery, pg_catalog.tsquery, pg_catalog.tsquery) RETURNS pg_catalog.tsquery
4041
LANGUAGE internal IMMUTABLE STRICT
4042
AS $$tsquery_rewrite$$;
4045
CREATE FUNCTION rewrite_accum(pg_catalog.tsquery, pg_catalog.tsquery[]) RETURNS pg_catalog.tsquery
4047
AS '$libdir/tsearch2', 'tsa_rewrite_accum';
4050
CREATE FUNCTION rewrite_finish(pg_catalog.tsquery) RETURNS pg_catalog.tsquery
4052
AS '$libdir/tsearch2', 'tsa_rewrite_finish';
4055
CREATE FUNCTION set_curcfg(integer) RETURNS void
4057
AS '$libdir/tsearch2', 'tsa_set_curcfg';
4060
CREATE FUNCTION set_curcfg(text) RETURNS void
4062
AS '$libdir/tsearch2', 'tsa_set_curcfg_byname';
4065
CREATE FUNCTION set_curdict(integer) RETURNS void
4067
AS '$libdir/tsearch2', 'tsa_set_curdict';
4070
CREATE FUNCTION set_curdict(text) RETURNS void
4072
AS '$libdir/tsearch2', 'tsa_set_curdict_byname';
4075
CREATE FUNCTION set_curprs(integer) RETURNS void
4077
AS '$libdir/tsearch2', 'tsa_set_curprs';
4080
CREATE FUNCTION set_curprs(text) RETURNS void
4082
AS '$libdir/tsearch2', 'tsa_set_curprs_byname';
4085
CREATE FUNCTION setweight(pg_catalog.tsvector, "char") RETURNS pg_catalog.tsvector
4086
LANGUAGE internal IMMUTABLE STRICT
4087
AS $$tsvector_setweight$$;
4090
CREATE FUNCTION show_curcfg() RETURNS oid
4091
LANGUAGE internal STABLE STRICT
4092
AS $$get_current_ts_config$$;
4095
CREATE FUNCTION snb_en_init(internal) RETURNS internal
4097
AS '$libdir/tsearch2', 'tsa_snb_en_init';
4100
CREATE FUNCTION snb_lexize(internal, internal, integer) RETURNS internal
4102
AS '$libdir/tsearch2', 'tsa_snb_lexize';
4105
CREATE FUNCTION snb_ru_init(internal) RETURNS internal
4107
AS '$libdir/tsearch2', 'tsa_snb_ru_init';
4110
CREATE FUNCTION snb_ru_init_koi8(internal) RETURNS internal
4112
AS '$libdir/tsearch2', 'tsa_snb_ru_init_koi8';
4115
CREATE FUNCTION snb_ru_init_utf8(internal) RETURNS internal
4117
AS '$libdir/tsearch2', 'tsa_snb_ru_init_utf8';
4120
CREATE FUNCTION spell_init(internal) RETURNS internal
4122
AS '$libdir/tsearch2', 'tsa_spell_init';
4125
CREATE FUNCTION spell_lexize(internal, internal, integer) RETURNS internal
4127
AS '$libdir/tsearch2', 'tsa_spell_lexize';
4130
CREATE FUNCTION stat(text) RETURNS SETOF statinfo
4131
LANGUAGE internal STRICT
4135
CREATE FUNCTION stat(text, text) RETURNS SETOF statinfo
4136
LANGUAGE internal STRICT
4140
CREATE FUNCTION strip(pg_catalog.tsvector) RETURNS pg_catalog.tsvector
4141
LANGUAGE internal IMMUTABLE STRICT
4142
AS $$tsvector_strip$$;
4145
CREATE FUNCTION syn_init(internal) RETURNS internal
4147
AS '$libdir/tsearch2', 'tsa_syn_init';
4150
CREATE FUNCTION syn_lexize(internal, internal, integer) RETURNS internal
4152
AS '$libdir/tsearch2', 'tsa_syn_lexize';
4155
CREATE FUNCTION thesaurus_init(internal) RETURNS internal
4157
AS '$libdir/tsearch2', 'tsa_thesaurus_init';
4160
CREATE FUNCTION thesaurus_lexize(internal, internal, integer, internal) RETURNS internal
4162
AS '$libdir/tsearch2', 'tsa_thesaurus_lexize';
4165
CREATE FUNCTION to_tsquery(oid, text) RETURNS pg_catalog.tsquery
4166
LANGUAGE internal IMMUTABLE STRICT
4167
AS $$to_tsquery_byid$$;
4170
CREATE FUNCTION to_tsquery(text, text) RETURNS pg_catalog.tsquery
4171
LANGUAGE c IMMUTABLE STRICT
4172
AS '$libdir/tsearch2', 'tsa_to_tsquery_name';
4175
CREATE FUNCTION to_tsquery(text) RETURNS pg_catalog.tsquery
4176
LANGUAGE internal IMMUTABLE STRICT
4180
CREATE FUNCTION to_tsvector(oid, text) RETURNS pg_catalog.tsvector
4181
LANGUAGE internal IMMUTABLE STRICT
4182
AS $$to_tsvector_byid$$;
4185
CREATE FUNCTION to_tsvector(text, text) RETURNS pg_catalog.tsvector
4186
LANGUAGE c IMMUTABLE STRICT
4187
AS '$libdir/tsearch2', 'tsa_to_tsvector_name';
4190
CREATE FUNCTION to_tsvector(text) RETURNS pg_catalog.tsvector
4191
LANGUAGE internal IMMUTABLE STRICT
4195
CREATE FUNCTION token_type(integer) RETURNS SETOF tokentype
4196
LANGUAGE internal STRICT ROWS 16
4197
AS $$ts_token_type_byid$$;
4200
CREATE FUNCTION token_type(text) RETURNS SETOF tokentype
4201
LANGUAGE internal STRICT ROWS 16
4202
AS $$ts_token_type_byname$$;
4205
CREATE FUNCTION token_type() RETURNS SETOF tokentype
4206
LANGUAGE c STRICT ROWS 16
4207
AS '$libdir/tsearch2', 'tsa_token_type_current';
4210
CREATE FUNCTION ts_debug(text) RETURNS SETOF tsdebug
4214
(select c.cfgname::text from pg_catalog.pg_ts_config as c
4215
where c.oid = show_curcfg()),
4216
t.alias as tok_type,
4217
t.descr as description,
4219
ARRAY ( SELECT m.mapdict::pg_catalog.regdictionary::pg_catalog.text
4220
FROM pg_catalog.pg_ts_config_map AS m
4221
WHERE m.mapcfg = show_curcfg() AND m.maptokentype = p.tokid
4222
ORDER BY m.mapseqno )
4224
strip(to_tsvector(p.token)) as tsvector
4226
parse( _get_parser_from_curcfg(), $1 ) as p,
4233
CREATE FUNCTION tsearch2() RETURNS trigger
4235
AS '$libdir/tsearch2', 'tsa_tsearch2';
4238
CREATE FUNCTION tsq_mcontained(pg_catalog.tsquery, pg_catalog.tsquery) RETURNS boolean
4239
LANGUAGE internal IMMUTABLE STRICT
4240
AS $$tsq_mcontained$$;
4243
CREATE FUNCTION tsq_mcontains(pg_catalog.tsquery, pg_catalog.tsquery) RETURNS boolean
4244
LANGUAGE internal IMMUTABLE STRICT
4245
AS $$tsq_mcontains$$;
4248
CREATE FUNCTION tsquery_and(pg_catalog.tsquery, pg_catalog.tsquery) RETURNS pg_catalog.tsquery
4249
LANGUAGE internal IMMUTABLE STRICT
4253
CREATE FUNCTION tsquery_not(pg_catalog.tsquery) RETURNS pg_catalog.tsquery
4254
LANGUAGE internal IMMUTABLE STRICT
4258
CREATE FUNCTION tsquery_or(pg_catalog.tsquery, pg_catalog.tsquery) RETURNS pg_catalog.tsquery
4259
LANGUAGE internal IMMUTABLE STRICT
4263
SET search_path = public, pg_catalog;
4266
PROCEDURE = debversion_gt,
4267
LEFTARG = debversion,
4268
RIGHTARG = debversion,
4274
COMMENT ON OPERATOR > (debversion, debversion) IS 'debversion greater-than';
4277
CREATE AGGREGATE max(debversion) (
4278
SFUNC = debversion_larger,
4285
PROCEDURE = debversion_lt,
4286
LEFTARG = debversion,
4287
RIGHTARG = debversion,
4293
COMMENT ON OPERATOR < (debversion, debversion) IS 'debversion less-than';
4296
CREATE AGGREGATE min(debversion) (
4297
SFUNC = debversion_smaller,
4303
SET search_path = ts2, pg_catalog;
4305
CREATE AGGREGATE rewrite(pg_catalog.tsquery[]) (
4306
SFUNC = rewrite_accum,
4307
STYPE = pg_catalog.tsquery,
4308
FINALFUNC = rewrite_finish
4312
SET search_path = public, pg_catalog;
4314
CREATE OPERATOR <= (
4315
PROCEDURE = debversion_le,
4316
LEFTARG = debversion,
4317
RIGHTARG = debversion,
4323
COMMENT ON OPERATOR <= (debversion, debversion) IS 'debversion less-than-or-equal';
4326
CREATE OPERATOR <> (
4327
PROCEDURE = debversion_ne,
4328
LEFTARG = debversion,
4329
RIGHTARG = debversion,
4335
COMMENT ON OPERATOR <> (debversion, debversion) IS 'debversion not equal';
4339
PROCEDURE = debversion_eq,
4340
LEFTARG = debversion,
4341
RIGHTARG = debversion,
4347
COMMENT ON OPERATOR = (debversion, debversion) IS 'debversion equal';
4350
CREATE OPERATOR >= (
4351
PROCEDURE = debversion_ge,
4352
LEFTARG = debversion,
4353
RIGHTARG = debversion,
4359
COMMENT ON OPERATOR >= (debversion, debversion) IS 'debversion greater-than-or-equal';
4362
CREATE OPERATOR FAMILY debversion_ops USING btree;
4365
CREATE OPERATOR CLASS debversion_ops
4366
DEFAULT FOR TYPE debversion USING btree AS
4367
OPERATOR 1 <(debversion,debversion) ,
4368
OPERATOR 2 <=(debversion,debversion) ,
4369
OPERATOR 3 =(debversion,debversion) ,
4370
OPERATOR 4 >=(debversion,debversion) ,
4371
OPERATOR 5 >(debversion,debversion) ,
4372
FUNCTION 1 debversion_cmp(debversion,debversion);
4375
CREATE OPERATOR FAMILY debversion_ops USING hash;
4378
CREATE OPERATOR CLASS debversion_ops
4379
DEFAULT FOR TYPE debversion USING hash AS
4380
OPERATOR 1 =(debversion,debversion) ,
4381
FUNCTION 1 debversion_hash(debversion);
4384
SET search_path = ts2, pg_catalog;
4386
CREATE OPERATOR FAMILY tsquery_ops USING btree;
4389
CREATE OPERATOR CLASS tsquery_ops
4390
FOR TYPE pg_catalog.tsquery USING btree AS
4391
OPERATOR 1 <(pg_catalog.tsquery,pg_catalog.tsquery) ,
4392
OPERATOR 2 <=(pg_catalog.tsquery,pg_catalog.tsquery) ,
4393
OPERATOR 3 =(pg_catalog.tsquery,pg_catalog.tsquery) ,
4394
OPERATOR 4 >=(pg_catalog.tsquery,pg_catalog.tsquery) ,
4395
OPERATOR 5 >(pg_catalog.tsquery,pg_catalog.tsquery) ,
4396
FUNCTION 1 tsquery_cmp(pg_catalog.tsquery,pg_catalog.tsquery);
4399
CREATE OPERATOR FAMILY tsvector_ops USING btree;
4402
CREATE OPERATOR CLASS tsvector_ops
4403
FOR TYPE pg_catalog.tsvector USING btree AS
4404
OPERATOR 1 <(pg_catalog.tsvector,pg_catalog.tsvector) ,
4405
OPERATOR 2 <=(pg_catalog.tsvector,pg_catalog.tsvector) ,
4406
OPERATOR 3 =(pg_catalog.tsvector,pg_catalog.tsvector) ,
4407
OPERATOR 4 >=(pg_catalog.tsvector,pg_catalog.tsvector) ,
4408
OPERATOR 5 >(pg_catalog.tsvector,pg_catalog.tsvector) ,
4409
FUNCTION 1 tsvector_cmp(pg_catalog.tsvector,pg_catalog.tsvector);
4412
SET search_path = pg_catalog;
4414
CREATE CAST (character AS public.debversion) WITH FUNCTION public.debversion(character);
4417
CREATE CAST (public.debversion AS character) WITHOUT FUNCTION AS ASSIGNMENT;
4420
CREATE CAST (public.debversion AS text) WITHOUT FUNCTION AS IMPLICIT;
4423
CREATE CAST (public.debversion AS character varying) WITHOUT FUNCTION AS IMPLICIT;
4426
CREATE CAST (text AS public.debversion) WITHOUT FUNCTION AS ASSIGNMENT;
4429
CREATE CAST (character varying AS public.debversion) WITHOUT FUNCTION AS ASSIGNMENT;
4432
SET search_path = ts2, pg_catalog;
4434
CREATE TEXT SEARCH CONFIGURATION "default" (
4435
PARSER = pg_catalog."default" );
4437
ALTER TEXT SEARCH CONFIGURATION "default"
4438
ADD MAPPING FOR asciiword WITH english_stem;
4440
ALTER TEXT SEARCH CONFIGURATION "default"
4441
ADD MAPPING FOR word WITH english_stem;
4443
ALTER TEXT SEARCH CONFIGURATION "default"
4444
ADD MAPPING FOR numword WITH simple;
4446
ALTER TEXT SEARCH CONFIGURATION "default"
4447
ADD MAPPING FOR email WITH simple;
4449
ALTER TEXT SEARCH CONFIGURATION "default"
4450
ADD MAPPING FOR url WITH simple;
4452
ALTER TEXT SEARCH CONFIGURATION "default"
4453
ADD MAPPING FOR host WITH simple;
4455
ALTER TEXT SEARCH CONFIGURATION "default"
4456
ADD MAPPING FOR sfloat WITH simple;
4458
ALTER TEXT SEARCH CONFIGURATION "default"
4459
ADD MAPPING FOR version WITH simple;
4461
ALTER TEXT SEARCH CONFIGURATION "default"
4462
ADD MAPPING FOR hword_numpart WITH simple;
4464
ALTER TEXT SEARCH CONFIGURATION "default"
4465
ADD MAPPING FOR hword_part WITH english_stem;
4467
ALTER TEXT SEARCH CONFIGURATION "default"
4468
ADD MAPPING FOR hword_asciipart WITH english_stem;
4470
ALTER TEXT SEARCH CONFIGURATION "default"
4471
ADD MAPPING FOR numhword WITH simple;
4473
ALTER TEXT SEARCH CONFIGURATION "default"
4474
ADD MAPPING FOR asciihword WITH english_stem;
4476
ALTER TEXT SEARCH CONFIGURATION "default"
4477
ADD MAPPING FOR hword WITH english_stem;
4479
ALTER TEXT SEARCH CONFIGURATION "default"
4480
ADD MAPPING FOR url_path WITH simple;
4482
ALTER TEXT SEARCH CONFIGURATION "default"
4483
ADD MAPPING FOR file WITH simple;
4485
ALTER TEXT SEARCH CONFIGURATION "default"
4486
ADD MAPPING FOR "float" WITH simple;
4488
ALTER TEXT SEARCH CONFIGURATION "default"
4489
ADD MAPPING FOR "int" WITH simple;
4491
ALTER TEXT SEARCH CONFIGURATION "default"
4492
ADD MAPPING FOR uint WITH simple;
4495
SET search_path = public, pg_catalog;
4497
CREATE TABLE accesspolicy (
4498
id integer NOT NULL,
4500
distribution integer,
4501
type integer NOT NULL,
4502
CONSTRAINT has_target CHECK (((product IS NULL) <> (distribution IS NULL)))
4506
CREATE SEQUENCE accesspolicy_id_seq
4514
ALTER SEQUENCE accesspolicy_id_seq OWNED BY accesspolicy.id;
4517
CREATE TABLE accesspolicyartifact (
4518
id integer NOT NULL,
4522
CONSTRAINT has_artifact CHECK (((bug IS NULL) <> (branch IS NULL)))
4526
CREATE SEQUENCE accesspolicyartifact_id_seq
4534
ALTER SEQUENCE accesspolicyartifact_id_seq OWNED BY accesspolicyartifact.id;
4537
CREATE TABLE accesspolicygrant (
4538
id integer NOT NULL,
4539
grantee integer NOT NULL,
4540
grantor integer NOT NULL,
4541
date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
4544
CONSTRAINT has_target CHECK (((policy IS NULL) <> (artifact IS NULL)))
4548
CREATE SEQUENCE accesspolicygrant_id_seq
4556
ALTER SEQUENCE accesspolicygrant_id_seq OWNED BY accesspolicygrant.id;
59
4559
CREATE TABLE account (
60
4560
id integer NOT NULL,
5304
15255
wikiname text NOT NULL
5307
15259
CREATE SEQUENCE wikiname_id_seq
5308
15261
INCREMENT BY 1
5313
15267
ALTER SEQUENCE wikiname_id_seq OWNED BY wikiname.id;
15270
ALTER TABLE accesspolicy ALTER COLUMN id SET DEFAULT nextval('accesspolicy_id_seq'::regclass);
15273
ALTER TABLE accesspolicyartifact ALTER COLUMN id SET DEFAULT nextval('accesspolicyartifact_id_seq'::regclass);
15276
ALTER TABLE accesspolicygrant ALTER COLUMN id SET DEFAULT nextval('accesspolicygrant_id_seq'::regclass);
5315
15279
ALTER TABLE account ALTER COLUMN id SET DEFAULT nextval('account_id_seq'::regclass);
5317
15282
ALTER TABLE accountpassword ALTER COLUMN id SET DEFAULT nextval('accountpassword_id_seq'::regclass);
5319
15285
ALTER TABLE announcement ALTER COLUMN id SET DEFAULT nextval('announcement_id_seq'::regclass);
5321
15288
ALTER TABLE answercontact ALTER COLUMN id SET DEFAULT nextval('answercontact_id_seq'::regclass);
5323
15291
ALTER TABLE apportjob ALTER COLUMN id SET DEFAULT nextval('apportjob_id_seq'::regclass);
5325
15294
ALTER TABLE archive ALTER COLUMN id SET DEFAULT nextval('archive_id_seq'::regclass);
5327
15297
ALTER TABLE archivearch ALTER COLUMN id SET DEFAULT nextval('archivearch_id_seq'::regclass);
5329
15300
ALTER TABLE archiveauthtoken ALTER COLUMN id SET DEFAULT nextval('archiveauthtoken_id_seq'::regclass);
5331
15303
ALTER TABLE archivedependency ALTER COLUMN id SET DEFAULT nextval('archivedependency_id_seq'::regclass);
5333
15306
ALTER TABLE archivejob ALTER COLUMN id SET DEFAULT nextval('archivejob_id_seq'::regclass);
5335
15309
ALTER TABLE archivepermission ALTER COLUMN id SET DEFAULT nextval('archivepermission_id_seq'::regclass);
5337
15312
ALTER TABLE archivesubscriber ALTER COLUMN id SET DEFAULT nextval('archivesubscriber_id_seq'::regclass);
5339
ALTER TABLE authtoken ALTER COLUMN id SET DEFAULT nextval('authtoken_id_seq'::regclass);
5341
15315
ALTER TABLE binarypackagebuild ALTER COLUMN id SET DEFAULT nextval('binarypackagebuild_id_seq'::regclass);
5343
15318
ALTER TABLE binarypackagename ALTER COLUMN id SET DEFAULT nextval('binarypackagename_id_seq'::regclass);
15321
ALTER TABLE binarypackagepath ALTER COLUMN id SET DEFAULT nextval('binarypackagepath_id_seq'::regclass);
5345
15324
ALTER TABLE binarypackagepublishinghistory ALTER COLUMN id SET DEFAULT nextval('binarypackagepublishinghistory_id_seq'::regclass);
5347
15327
ALTER TABLE binarypackagerelease ALTER COLUMN id SET DEFAULT nextval('binarypackagerelease_id_seq'::regclass);
5349
15330
ALTER TABLE binarypackagereleasedownloadcount ALTER COLUMN id SET DEFAULT nextval('binarypackagereleasedownloadcount_id_seq'::regclass);
5351
ALTER TABLE bounty ALTER COLUMN id SET DEFAULT nextval('bounty_id_seq'::regclass);
5353
ALTER TABLE bountymessage ALTER COLUMN id SET DEFAULT nextval('bountymessage_id_seq'::regclass);
5355
ALTER TABLE bountysubscription ALTER COLUMN id SET DEFAULT nextval('bountysubscription_id_seq'::regclass);
5357
15333
ALTER TABLE branch ALTER COLUMN id SET DEFAULT nextval('branch_id_seq'::regclass);
5359
15336
ALTER TABLE branchjob ALTER COLUMN id SET DEFAULT nextval('branchjob_id_seq'::regclass);
5361
15339
ALTER TABLE branchmergeproposal ALTER COLUMN id SET DEFAULT nextval('branchmergeproposal_id_seq'::regclass);
5363
15342
ALTER TABLE branchmergeproposaljob ALTER COLUMN id SET DEFAULT nextval('branchmergeproposaljob_id_seq'::regclass);
5365
ALTER TABLE branchmergerobot ALTER COLUMN id SET DEFAULT nextval('branchmergerobot_id_seq'::regclass);
5367
ALTER TABLE branchrevision ALTER COLUMN id SET DEFAULT nextval('branchrevision_id_seq'::regclass);
15345
ALTER TABLE branchmergequeue ALTER COLUMN id SET DEFAULT nextval('branchmergequeue_id_seq'::regclass);
5369
15348
ALTER TABLE branchsubscription ALTER COLUMN id SET DEFAULT nextval('branchsubscription_id_seq'::regclass);
5371
15351
ALTER TABLE branchvisibilitypolicy ALTER COLUMN id SET DEFAULT nextval('branchvisibilitypolicy_id_seq'::regclass);
5373
15354
ALTER TABLE bug ALTER COLUMN id SET DEFAULT nextval('bug_id_seq'::regclass);
5375
15357
ALTER TABLE bugactivity ALTER COLUMN id SET DEFAULT nextval('bugactivity_id_seq'::regclass);
5377
15360
ALTER TABLE bugaffectsperson ALTER COLUMN id SET DEFAULT nextval('bugaffectsperson_id_seq'::regclass);
5379
15363
ALTER TABLE bugattachment ALTER COLUMN id SET DEFAULT nextval('bugattachment_id_seq'::regclass);
5381
15366
ALTER TABLE bugbranch ALTER COLUMN id SET DEFAULT nextval('bugbranch_id_seq'::regclass);
5383
15369
ALTER TABLE bugcve ALTER COLUMN id SET DEFAULT nextval('bugcve_id_seq'::regclass);
5385
15372
ALTER TABLE bugjob ALTER COLUMN id SET DEFAULT nextval('bugjob_id_seq'::regclass);
5387
15375
ALTER TABLE bugmessage ALTER COLUMN id SET DEFAULT nextval('bugmessage_id_seq'::regclass);
5389
15378
ALTER TABLE bugnomination ALTER COLUMN id SET DEFAULT nextval('bugnomination_id_seq'::regclass);
5391
15381
ALTER TABLE bugnotification ALTER COLUMN id SET DEFAULT nextval('bugnotification_id_seq'::regclass);
5393
15384
ALTER TABLE bugnotificationattachment ALTER COLUMN id SET DEFAULT nextval('bugnotificationattachment_id_seq'::regclass);
5395
15387
ALTER TABLE bugnotificationrecipient ALTER COLUMN id SET DEFAULT nextval('bugnotificationrecipient_id_seq'::regclass);
5397
ALTER TABLE bugpackageinfestation ALTER COLUMN id SET DEFAULT nextval('bugpackageinfestation_id_seq'::regclass);
5399
ALTER TABLE bugproductinfestation ALTER COLUMN id SET DEFAULT nextval('bugproductinfestation_id_seq'::regclass);
5401
15390
ALTER TABLE bugsubscription ALTER COLUMN id SET DEFAULT nextval('bugsubscription_id_seq'::regclass);
15393
ALTER TABLE bugsubscriptionfilter ALTER COLUMN id SET DEFAULT nextval('bugsubscriptionfilter_id_seq'::regclass);
15396
ALTER TABLE bugsubscriptionfilterimportance ALTER COLUMN id SET DEFAULT nextval('bugsubscriptionfilterimportance_id_seq'::regclass);
15399
ALTER TABLE bugsubscriptionfilterstatus ALTER COLUMN id SET DEFAULT nextval('bugsubscriptionfilterstatus_id_seq'::regclass);
15402
ALTER TABLE bugsubscriptionfiltertag ALTER COLUMN id SET DEFAULT nextval('bugsubscriptionfiltertag_id_seq'::regclass);
15405
ALTER TABLE bugsummary ALTER COLUMN id SET DEFAULT nextval('bugsummary_id_seq'::regclass);
15408
ALTER TABLE bugsummaryjournal ALTER COLUMN id SET DEFAULT nextval('bugsummaryjournal_id_seq'::regclass);
5403
15411
ALTER TABLE bugtag ALTER COLUMN id SET DEFAULT nextval('bugtag_id_seq'::regclass);
5405
15414
ALTER TABLE bugtask ALTER COLUMN id SET DEFAULT nextval('bugtask_id_seq'::regclass);
5407
15417
ALTER TABLE bugtracker ALTER COLUMN id SET DEFAULT nextval('bugtracker_id_seq'::regclass);
5409
15420
ALTER TABLE bugtrackeralias ALTER COLUMN id SET DEFAULT nextval('bugtrackeralias_id_seq'::regclass);
15423
ALTER TABLE bugtrackercomponent ALTER COLUMN id SET DEFAULT nextval('bugtrackercomponent_id_seq'::regclass);
15426
ALTER TABLE bugtrackercomponentgroup ALTER COLUMN id SET DEFAULT nextval('bugtrackercomponentgroup_id_seq'::regclass);
5411
15429
ALTER TABLE bugtrackerperson ALTER COLUMN id SET DEFAULT nextval('bugtrackerperson_id_seq'::regclass);
5413
15432
ALTER TABLE bugwatch ALTER COLUMN id SET DEFAULT nextval('bugwatch_id_seq'::regclass);
5415
15435
ALTER TABLE bugwatchactivity ALTER COLUMN id SET DEFAULT nextval('bugwatchactivity_id_seq'::regclass);
5417
15438
ALTER TABLE builder ALTER COLUMN id SET DEFAULT nextval('builder_id_seq'::regclass);
5419
15441
ALTER TABLE buildfarmjob ALTER COLUMN id SET DEFAULT nextval('buildfarmjob_id_seq'::regclass);
5421
15444
ALTER TABLE buildpackagejob ALTER COLUMN id SET DEFAULT nextval('buildpackagejob_id_seq'::regclass);
5423
15447
ALTER TABLE buildqueue ALTER COLUMN id SET DEFAULT nextval('buildqueue_id_seq'::regclass);
5425
15450
ALTER TABLE codeimport ALTER COLUMN id SET DEFAULT nextval('codeimport_id_seq'::regclass);
5427
15453
ALTER TABLE codeimportevent ALTER COLUMN id SET DEFAULT nextval('codeimportevent_id_seq'::regclass);
5429
15456
ALTER TABLE codeimporteventdata ALTER COLUMN id SET DEFAULT nextval('codeimporteventdata_id_seq'::regclass);
5431
15459
ALTER TABLE codeimportjob ALTER COLUMN id SET DEFAULT nextval('codeimportjob_id_seq'::regclass);
5433
15462
ALTER TABLE codeimportmachine ALTER COLUMN id SET DEFAULT nextval('codeimportmachine_id_seq'::regclass);
5435
15465
ALTER TABLE codeimportresult ALTER COLUMN id SET DEFAULT nextval('codeimportresult_id_seq'::regclass);
5437
15468
ALTER TABLE codereviewmessage ALTER COLUMN id SET DEFAULT nextval('codereviewmessage_id_seq'::regclass);
5439
15471
ALTER TABLE codereviewvote ALTER COLUMN id SET DEFAULT nextval('codereviewvote_id_seq'::regclass);
5441
15474
ALTER TABLE commercialsubscription ALTER COLUMN id SET DEFAULT nextval('commercialsubscription_id_seq'::regclass);
5443
15477
ALTER TABLE component ALTER COLUMN id SET DEFAULT nextval('component_id_seq'::regclass);
5445
15480
ALTER TABLE componentselection ALTER COLUMN id SET DEFAULT nextval('componentselection_id_seq'::regclass);
5447
15483
ALTER TABLE continent ALTER COLUMN id SET DEFAULT nextval('continent_id_seq'::regclass);
5449
15486
ALTER TABLE country ALTER COLUMN id SET DEFAULT nextval('country_id_seq'::regclass);
5451
15489
ALTER TABLE customlanguagecode ALTER COLUMN id SET DEFAULT nextval('customlanguagecode_id_seq'::regclass);
5453
15492
ALTER TABLE cve ALTER COLUMN id SET DEFAULT nextval('cve_id_seq'::regclass);
5455
15495
ALTER TABLE cvereference ALTER COLUMN id SET DEFAULT nextval('cvereference_id_seq'::regclass);
5457
15498
ALTER TABLE diff ALTER COLUMN id SET DEFAULT nextval('diff_id_seq'::regclass);
5459
15501
ALTER TABLE distribution ALTER COLUMN id SET DEFAULT nextval('distribution_id_seq'::regclass);
5461
ALTER TABLE distributionbounty ALTER COLUMN id SET DEFAULT nextval('distributionbounty_id_seq'::regclass);
15504
ALTER TABLE distributionjob ALTER COLUMN id SET DEFAULT nextval('distributionjob_id_seq'::regclass);
5463
15507
ALTER TABLE distributionmirror ALTER COLUMN id SET DEFAULT nextval('distributionmirror_id_seq'::regclass);
5465
15510
ALTER TABLE distributionsourcepackage ALTER COLUMN id SET DEFAULT nextval('distributionsourcepackage_id_seq'::regclass);
5467
15513
ALTER TABLE distributionsourcepackagecache ALTER COLUMN id SET DEFAULT nextval('distributionsourcepackagecache_id_seq'::regclass);
5469
15516
ALTER TABLE distroarchseries ALTER COLUMN id SET DEFAULT nextval('distroarchseries_id_seq'::regclass);
5471
ALTER TABLE distrocomponentuploader ALTER COLUMN id SET DEFAULT nextval('distrocomponentuploader_id_seq'::regclass);
5473
15519
ALTER TABLE distroseries ALTER COLUMN id SET DEFAULT nextval('distroseries_id_seq'::regclass);
15522
ALTER TABLE distroseriesdifference ALTER COLUMN id SET DEFAULT nextval('distroseriesdifference_id_seq'::regclass);
15525
ALTER TABLE distroseriesdifferencemessage ALTER COLUMN id SET DEFAULT nextval('distroseriesdifferencemessage_id_seq'::regclass);
5475
15528
ALTER TABLE distroserieslanguage ALTER COLUMN id SET DEFAULT nextval('distroserieslanguage_id_seq'::regclass);
5477
15531
ALTER TABLE distroseriespackagecache ALTER COLUMN id SET DEFAULT nextval('distroseriespackagecache_id_seq'::regclass);
15534
ALTER TABLE distroseriesparent ALTER COLUMN id SET DEFAULT nextval('distroseriesparent_id_seq'::regclass);
5479
15537
ALTER TABLE emailaddress ALTER COLUMN id SET DEFAULT nextval('emailaddress_id_seq'::regclass);
5481
15540
ALTER TABLE entitlement ALTER COLUMN id SET DEFAULT nextval('entitlement_id_seq'::regclass);
5483
15543
ALTER TABLE faq ALTER COLUMN id SET DEFAULT nextval('faq_id_seq'::regclass);
5485
15546
ALTER TABLE featuredproject ALTER COLUMN id SET DEFAULT nextval('featuredproject_id_seq'::regclass);
15549
ALTER TABLE featureflagchangelogentry ALTER COLUMN id SET DEFAULT nextval('featureflagchangelogentry_id_seq'::regclass);
5487
15552
ALTER TABLE flatpackagesetinclusion ALTER COLUMN id SET DEFAULT nextval('flatpackagesetinclusion_id_seq'::regclass);
5489
15555
ALTER TABLE fticache ALTER COLUMN id SET DEFAULT nextval('fticache_id_seq'::regclass);
5491
15558
ALTER TABLE gpgkey ALTER COLUMN id SET DEFAULT nextval('gpgkey_id_seq'::regclass);
5493
15561
ALTER TABLE hwdevice ALTER COLUMN id SET DEFAULT nextval('hwdevice_id_seq'::regclass);
5495
15564
ALTER TABLE hwdeviceclass ALTER COLUMN id SET DEFAULT nextval('hwdeviceclass_id_seq'::regclass);
5497
15567
ALTER TABLE hwdevicedriverlink ALTER COLUMN id SET DEFAULT nextval('hwdevicedriverlink_id_seq'::regclass);
5499
15570
ALTER TABLE hwdevicenamevariant ALTER COLUMN id SET DEFAULT nextval('hwdevicenamevariant_id_seq'::regclass);
5501
15573
ALTER TABLE hwdmihandle ALTER COLUMN id SET DEFAULT nextval('hwdmihandle_id_seq'::regclass);
5503
15576
ALTER TABLE hwdmivalue ALTER COLUMN id SET DEFAULT nextval('hwdmivalue_id_seq'::regclass);
5505
15579
ALTER TABLE hwdriver ALTER COLUMN id SET DEFAULT nextval('hwdriver_id_seq'::regclass);
5507
15582
ALTER TABLE hwsubmission ALTER COLUMN id SET DEFAULT nextval('hwsubmission_id_seq'::regclass);
5509
15585
ALTER TABLE hwsubmissionbug ALTER COLUMN id SET DEFAULT nextval('hwsubmissionbug_id_seq'::regclass);
5511
15588
ALTER TABLE hwsubmissiondevice ALTER COLUMN id SET DEFAULT nextval('hwsubmissiondevice_id_seq'::regclass);
5513
15591
ALTER TABLE hwsystemfingerprint ALTER COLUMN id SET DEFAULT nextval('hwsystemfingerprint_id_seq'::regclass);
5515
15594
ALTER TABLE hwtest ALTER COLUMN id SET DEFAULT nextval('hwtest_id_seq'::regclass);
5517
15597
ALTER TABLE hwtestanswer ALTER COLUMN id SET DEFAULT nextval('hwtestanswer_id_seq'::regclass);
5519
15600
ALTER TABLE hwtestanswerchoice ALTER COLUMN id SET DEFAULT nextval('hwtestanswerchoice_id_seq'::regclass);
5521
15603
ALTER TABLE hwtestanswercount ALTER COLUMN id SET DEFAULT nextval('hwtestanswercount_id_seq'::regclass);
5523
15606
ALTER TABLE hwtestanswercountdevice ALTER COLUMN id SET DEFAULT nextval('hwtestanswercountdevice_id_seq'::regclass);
5525
15609
ALTER TABLE hwtestanswerdevice ALTER COLUMN id SET DEFAULT nextval('hwtestanswerdevice_id_seq'::regclass);
5527
15612
ALTER TABLE hwvendorid ALTER COLUMN id SET DEFAULT nextval('hwvendorid_id_seq'::regclass);
5529
15615
ALTER TABLE hwvendorname ALTER COLUMN id SET DEFAULT nextval('hwvendorname_id_seq'::regclass);
15618
ALTER TABLE incrementaldiff ALTER COLUMN id SET DEFAULT nextval('incrementaldiff_id_seq'::regclass);
5531
15621
ALTER TABLE ircid ALTER COLUMN id SET DEFAULT nextval('ircid_id_seq'::regclass);
5533
15624
ALTER TABLE jabberid ALTER COLUMN id SET DEFAULT nextval('jabberid_id_seq'::regclass);
5535
15627
ALTER TABLE job ALTER COLUMN id SET DEFAULT nextval('job_id_seq'::regclass);
5537
15630
ALTER TABLE karma ALTER COLUMN id SET DEFAULT nextval('karma_id_seq'::regclass);
5539
15633
ALTER TABLE karmaaction ALTER COLUMN id SET DEFAULT nextval('karmaaction_id_seq'::regclass);
5541
15636
ALTER TABLE karmacache ALTER COLUMN id SET DEFAULT nextval('karmacache_id_seq'::regclass);
5543
15639
ALTER TABLE karmacategory ALTER COLUMN id SET DEFAULT nextval('karmacategory_id_seq'::regclass);
5545
15642
ALTER TABLE karmatotalcache ALTER COLUMN id SET DEFAULT nextval('karmatotalcache_id_seq'::regclass);
5547
15645
ALTER TABLE language ALTER COLUMN id SET DEFAULT nextval('language_id_seq'::regclass);
5549
15648
ALTER TABLE languagepack ALTER COLUMN id SET DEFAULT nextval('languagepack_id_seq'::regclass);
15651
ALTER TABLE launchpaddatabaseupdatelog ALTER COLUMN id SET DEFAULT nextval('launchpaddatabaseupdatelog_id_seq'::regclass);
5551
15654
ALTER TABLE launchpadstatistic ALTER COLUMN id SET DEFAULT nextval('launchpadstatistic_id_seq'::regclass);
5553
15657
ALTER TABLE libraryfilealias ALTER COLUMN id SET DEFAULT nextval('libraryfilealias_id_seq'::regclass);
5555
15660
ALTER TABLE libraryfilecontent ALTER COLUMN id SET DEFAULT nextval('libraryfilecontent_id_seq'::regclass);
5557
15663
ALTER TABLE libraryfiledownloadcount ALTER COLUMN id SET DEFAULT nextval('libraryfiledownloadcount_id_seq'::regclass);
5559
15666
ALTER TABLE logintoken ALTER COLUMN id SET DEFAULT nextval('logintoken_id_seq'::regclass);
5561
15669
ALTER TABLE mailinglist ALTER COLUMN id SET DEFAULT nextval('mailinglist_id_seq'::regclass);
5563
ALTER TABLE mailinglistban ALTER COLUMN id SET DEFAULT nextval('mailinglistban_id_seq'::regclass);
5565
15672
ALTER TABLE mailinglistsubscription ALTER COLUMN id SET DEFAULT nextval('mailinglistsubscription_id_seq'::regclass);
5567
ALTER TABLE mentoringoffer ALTER COLUMN id SET DEFAULT nextval('mentoringoffer_id_seq'::regclass);
5569
15675
ALTER TABLE mergedirectivejob ALTER COLUMN id SET DEFAULT nextval('mergedirectivejob_id_seq'::regclass);
5571
15678
ALTER TABLE message ALTER COLUMN id SET DEFAULT nextval('message_id_seq'::regclass);
5573
15681
ALTER TABLE messageapproval ALTER COLUMN id SET DEFAULT nextval('messageapproval_id_seq'::regclass);
5575
15684
ALTER TABLE messagechunk ALTER COLUMN id SET DEFAULT nextval('messagechunk_id_seq'::regclass);
5577
15687
ALTER TABLE milestone ALTER COLUMN id SET DEFAULT nextval('milestone_id_seq'::regclass);
5579
15690
ALTER TABLE mirror ALTER COLUMN id SET DEFAULT nextval('mirror_id_seq'::regclass);
5581
15693
ALTER TABLE mirrorcdimagedistroseries ALTER COLUMN id SET DEFAULT nextval('mirrorcdimagedistroseries_id_seq'::regclass);
5583
15696
ALTER TABLE mirrorcontent ALTER COLUMN id SET DEFAULT nextval('mirrorcontent_id_seq'::regclass);
5585
15699
ALTER TABLE mirrordistroarchseries ALTER COLUMN id SET DEFAULT nextval('mirrordistroarchseries_id_seq'::regclass);
5587
15702
ALTER TABLE mirrordistroseriessource ALTER COLUMN id SET DEFAULT nextval('mirrordistroseriessource_id_seq'::regclass);
5589
15705
ALTER TABLE mirrorproberecord ALTER COLUMN id SET DEFAULT nextval('mirrorproberecord_id_seq'::regclass);
5591
15708
ALTER TABLE mirrorsourcecontent ALTER COLUMN id SET DEFAULT nextval('mirrorsourcecontent_id_seq'::regclass);
5593
15711
ALTER TABLE nameblacklist ALTER COLUMN id SET DEFAULT nextval('nameblacklist_id_seq'::regclass);
5595
15714
ALTER TABLE oauthaccesstoken ALTER COLUMN id SET DEFAULT nextval('oauthaccesstoken_id_seq'::regclass);
5597
15717
ALTER TABLE oauthconsumer ALTER COLUMN id SET DEFAULT nextval('oauthconsumer_id_seq'::regclass);
5599
ALTER TABLE oauthnonce ALTER COLUMN id SET DEFAULT nextval('oauthnonce_id_seq'::regclass);
5601
15720
ALTER TABLE oauthrequesttoken ALTER COLUMN id SET DEFAULT nextval('oauthrequesttoken_id_seq'::regclass);
5603
15723
ALTER TABLE officialbugtag ALTER COLUMN id SET DEFAULT nextval('officialbugtag_id_seq'::regclass);
5605
ALTER TABLE openidrpconfig ALTER COLUMN id SET DEFAULT nextval('openidrpconfig_id_seq'::regclass);
5607
ALTER TABLE openidrpsummary ALTER COLUMN id SET DEFAULT nextval('openidrpsummary_id_seq'::regclass);
5609
ALTER TABLE packagebugsupervisor ALTER COLUMN id SET DEFAULT nextval('packagebugsupervisor_id_seq'::regclass);
5611
15726
ALTER TABLE packagebuild ALTER COLUMN id SET DEFAULT nextval('packagebuild_id_seq'::regclass);
15729
ALTER TABLE packagecopyjob ALTER COLUMN id SET DEFAULT nextval('packagecopyjob_id_seq'::regclass);
5613
15732
ALTER TABLE packagecopyrequest ALTER COLUMN id SET DEFAULT nextval('packagecopyrequest_id_seq'::regclass);
5615
15735
ALTER TABLE packagediff ALTER COLUMN id SET DEFAULT nextval('packagediff_id_seq'::regclass);
5617
ALTER TABLE packageselection ALTER COLUMN id SET DEFAULT nextval('packageselection_id_seq'::regclass);
5619
15738
ALTER TABLE packageset ALTER COLUMN id SET DEFAULT nextval('packageset_id_seq'::regclass);
5621
15741
ALTER TABLE packagesetgroup ALTER COLUMN id SET DEFAULT nextval('packagesetgroup_id_seq'::regclass);
5623
15744
ALTER TABLE packagesetinclusion ALTER COLUMN id SET DEFAULT nextval('packagesetinclusion_id_seq'::regclass);
5625
15747
ALTER TABLE packagesetsources ALTER COLUMN id SET DEFAULT nextval('packagesetsources_id_seq'::regclass);
5627
15750
ALTER TABLE packageupload ALTER COLUMN id SET DEFAULT nextval('packageupload_id_seq'::regclass);
5629
15753
ALTER TABLE packageuploadbuild ALTER COLUMN id SET DEFAULT nextval('packageuploadbuild_id_seq'::regclass);
5631
15756
ALTER TABLE packageuploadcustom ALTER COLUMN id SET DEFAULT nextval('packageuploadcustom_id_seq'::regclass);
5633
15759
ALTER TABLE packageuploadsource ALTER COLUMN id SET DEFAULT nextval('packageuploadsource_id_seq'::regclass);
15762
ALTER TABLE packagingjob ALTER COLUMN id SET DEFAULT nextval('packagingjob_id_seq'::regclass);
5635
15765
ALTER TABLE parsedapachelog ALTER COLUMN id SET DEFAULT nextval('parsedapachelog_id_seq'::regclass);
5637
15768
ALTER TABLE person ALTER COLUMN id SET DEFAULT nextval('person_id_seq'::regclass);
5639
15771
ALTER TABLE personlanguage ALTER COLUMN id SET DEFAULT nextval('personlanguage_id_seq'::regclass);
5641
15774
ALTER TABLE personlocation ALTER COLUMN id SET DEFAULT nextval('personlocation_id_seq'::regclass);
5643
15777
ALTER TABLE personnotification ALTER COLUMN id SET DEFAULT nextval('personnotification_id_seq'::regclass);
15780
ALTER TABLE persontransferjob ALTER COLUMN id SET DEFAULT nextval('persontransferjob_id_seq'::regclass);
5645
15783
ALTER TABLE pillarname ALTER COLUMN id SET DEFAULT nextval('pillarname_id_seq'::regclass);
5647
15786
ALTER TABLE pocketchroot ALTER COLUMN id SET DEFAULT nextval('pocketchroot_id_seq'::regclass);
5649
ALTER TABLE pocomment ALTER COLUMN id SET DEFAULT nextval('pocomment_id_seq'::regclass);
5651
15789
ALTER TABLE poexportrequest ALTER COLUMN id SET DEFAULT nextval('poexportrequest_id_seq'::regclass);
5653
15792
ALTER TABLE pofile ALTER COLUMN id SET DEFAULT nextval('pofile_id_seq'::regclass);
5655
15795
ALTER TABLE pofiletranslator ALTER COLUMN id SET DEFAULT nextval('pofiletranslator_id_seq'::regclass);
5657
15798
ALTER TABLE poll ALTER COLUMN id SET DEFAULT nextval('poll_id_seq'::regclass);
5659
15801
ALTER TABLE polloption ALTER COLUMN id SET DEFAULT nextval('polloption_id_seq'::regclass);
5661
15804
ALTER TABLE pomsgid ALTER COLUMN id SET DEFAULT nextval('pomsgid_id_seq'::regclass);
5663
ALTER TABLE posubscription ALTER COLUMN id SET DEFAULT nextval('posubscription_id_seq'::regclass);
5665
15807
ALTER TABLE potemplate ALTER COLUMN id SET DEFAULT nextval('potemplate_id_seq'::regclass);
5667
15810
ALTER TABLE potmsgset ALTER COLUMN id SET DEFAULT nextval('potmsgset_id_seq'::regclass);
5669
15813
ALTER TABLE potranslation ALTER COLUMN id SET DEFAULT nextval('potranslation_id_seq'::regclass);
5671
15816
ALTER TABLE previewdiff ALTER COLUMN id SET DEFAULT nextval('previewdiff_id_seq'::regclass);
5673
15819
ALTER TABLE processor ALTER COLUMN id SET DEFAULT nextval('processor_id_seq'::regclass);
5675
15822
ALTER TABLE processorfamily ALTER COLUMN id SET DEFAULT nextval('processorfamily_id_seq'::regclass);
5677
15825
ALTER TABLE product ALTER COLUMN id SET DEFAULT nextval('product_id_seq'::regclass);
5679
ALTER TABLE productbounty ALTER COLUMN id SET DEFAULT nextval('productbounty_id_seq'::regclass);
5681
ALTER TABLE productcvsmodule ALTER COLUMN id SET DEFAULT nextval('productcvsmodule_id_seq'::regclass);
5683
15828
ALTER TABLE productlicense ALTER COLUMN id SET DEFAULT nextval('productlicense_id_seq'::regclass);
5685
15831
ALTER TABLE productrelease ALTER COLUMN id SET DEFAULT nextval('productrelease_id_seq'::regclass);
5687
15834
ALTER TABLE productseries ALTER COLUMN id SET DEFAULT nextval('productseries_id_seq'::regclass);
5689
ALTER TABLE productseriescodeimport ALTER COLUMN id SET DEFAULT nextval('productseriescodeimport_id_seq'::regclass);
5691
ALTER TABLE productsvnmodule ALTER COLUMN id SET DEFAULT nextval('productsvnmodule_id_seq'::regclass);
5693
15837
ALTER TABLE project ALTER COLUMN id SET DEFAULT nextval('project_id_seq'::regclass);
5695
ALTER TABLE projectbounty ALTER COLUMN id SET DEFAULT nextval('projectbounty_id_seq'::regclass);
5697
ALTER TABLE projectrelationship ALTER COLUMN id SET DEFAULT nextval('projectrelationship_id_seq'::regclass);
5699
ALTER TABLE pushmirroraccess ALTER COLUMN id SET DEFAULT nextval('pushmirroraccess_id_seq'::regclass);
15840
ALTER TABLE publisherconfig ALTER COLUMN id SET DEFAULT nextval('publisherconfig_id_seq'::regclass);
5701
15843
ALTER TABLE question ALTER COLUMN id SET DEFAULT nextval('question_id_seq'::regclass);
5703
15846
ALTER TABLE questionbug ALTER COLUMN id SET DEFAULT nextval('questionbug_id_seq'::regclass);
15849
ALTER TABLE questionjob ALTER COLUMN id SET DEFAULT nextval('questionjob_id_seq'::regclass);
5705
15852
ALTER TABLE questionmessage ALTER COLUMN id SET DEFAULT nextval('questionmessage_id_seq'::regclass);
5707
15855
ALTER TABLE questionreopening ALTER COLUMN id SET DEFAULT nextval('questionreopening_id_seq'::regclass);
5709
15858
ALTER TABLE questionsubscription ALTER COLUMN id SET DEFAULT nextval('questionsubscription_id_seq'::regclass);
5711
ALTER TABLE requestedcds ALTER COLUMN id SET DEFAULT nextval('requestedcds_id_seq'::regclass);
5713
15861
ALTER TABLE revision ALTER COLUMN id SET DEFAULT nextval('revision_id_seq'::regclass);
5715
15864
ALTER TABLE revisionauthor ALTER COLUMN id SET DEFAULT nextval('revisionauthor_id_seq'::regclass);
5717
15867
ALTER TABLE revisioncache ALTER COLUMN id SET DEFAULT nextval('revisioncache_id_seq'::regclass);
5719
15870
ALTER TABLE revisionparent ALTER COLUMN id SET DEFAULT nextval('revisionparent_id_seq'::regclass);
5721
15873
ALTER TABLE revisionproperty ALTER COLUMN id SET DEFAULT nextval('revisionproperty_id_seq'::regclass);
5723
15876
ALTER TABLE scriptactivity ALTER COLUMN id SET DEFAULT nextval('scriptactivity_id_seq'::regclass);
5725
15879
ALTER TABLE section ALTER COLUMN id SET DEFAULT nextval('section_id_seq'::regclass);
5727
15882
ALTER TABLE sectionselection ALTER COLUMN id SET DEFAULT nextval('sectionselection_id_seq'::regclass);
5729
15885
ALTER TABLE seriessourcepackagebranch ALTER COLUMN id SET DEFAULT nextval('seriessourcepackagebranch_id_seq'::regclass);
5731
ALTER TABLE shipitreport ALTER COLUMN id SET DEFAULT nextval('shipitreport_id_seq'::regclass);
5733
ALTER TABLE shipitsurvey ALTER COLUMN id SET DEFAULT nextval('shipitsurvey_id_seq'::regclass);
5735
ALTER TABLE shipitsurveyanswer ALTER COLUMN id SET DEFAULT nextval('shipitsurveyanswer_id_seq'::regclass);
5737
ALTER TABLE shipitsurveyquestion ALTER COLUMN id SET DEFAULT nextval('shipitsurveyquestion_id_seq'::regclass);
5739
ALTER TABLE shipitsurveyresult ALTER COLUMN id SET DEFAULT nextval('shipitsurveyresult_id_seq'::regclass);
5741
ALTER TABLE shipment ALTER COLUMN id SET DEFAULT nextval('shipment_id_seq'::regclass);
5743
ALTER TABLE shippingrequest ALTER COLUMN id SET DEFAULT nextval('shippingrequest_id_seq'::regclass);
5745
ALTER TABLE shippingrun ALTER COLUMN id SET DEFAULT nextval('shippingrun_id_seq'::regclass);
5747
15888
ALTER TABLE signedcodeofconduct ALTER COLUMN id SET DEFAULT nextval('signedcodeofconduct_id_seq'::regclass);
5749
15891
ALTER TABLE sourcepackageformatselection ALTER COLUMN id SET DEFAULT nextval('sourcepackageformatselection_id_seq'::regclass);
5751
15894
ALTER TABLE sourcepackagename ALTER COLUMN id SET DEFAULT nextval('sourcepackagename_id_seq'::regclass);
5753
15897
ALTER TABLE sourcepackagepublishinghistory ALTER COLUMN id SET DEFAULT nextval('sourcepackagepublishinghistory_id_seq'::regclass);
5755
15900
ALTER TABLE sourcepackagerecipe ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipe_id_seq'::regclass);
5757
15903
ALTER TABLE sourcepackagerecipebuild ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipebuild_id_seq'::regclass);
5759
15906
ALTER TABLE sourcepackagerecipebuildjob ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipebuildjob_id_seq'::regclass);
5761
15909
ALTER TABLE sourcepackagerecipedata ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipedata_id_seq'::regclass);
5763
15912
ALTER TABLE sourcepackagerecipedatainstruction ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipedatainstruction_id_seq'::regclass);
5765
15915
ALTER TABLE sourcepackagerecipedistroseries ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipedistroseries_id_seq'::regclass);
5767
15918
ALTER TABLE sourcepackagerelease ALTER COLUMN id SET DEFAULT nextval('sourcepackagerelease_id_seq'::regclass);
5769
15921
ALTER TABLE specification ALTER COLUMN id SET DEFAULT nextval('specification_id_seq'::regclass);
5771
15924
ALTER TABLE specificationbranch ALTER COLUMN id SET DEFAULT nextval('specificationbranch_id_seq'::regclass);
5773
15927
ALTER TABLE specificationbug ALTER COLUMN id SET DEFAULT nextval('specificationbug_id_seq'::regclass);
5775
15930
ALTER TABLE specificationdependency ALTER COLUMN id SET DEFAULT nextval('specificationdependency_id_seq'::regclass);
5777
15933
ALTER TABLE specificationfeedback ALTER COLUMN id SET DEFAULT nextval('specificationfeedback_id_seq'::regclass);
5779
15936
ALTER TABLE specificationmessage ALTER COLUMN id SET DEFAULT nextval('specificationmessage_id_seq'::regclass);
5781
15939
ALTER TABLE specificationsubscription ALTER COLUMN id SET DEFAULT nextval('specificationsubscription_id_seq'::regclass);
5783
15942
ALTER TABLE sprint ALTER COLUMN id SET DEFAULT nextval('sprint_id_seq'::regclass);
5785
15945
ALTER TABLE sprintattendance ALTER COLUMN id SET DEFAULT nextval('sprintattendance_id_seq'::regclass);
5787
15948
ALTER TABLE sprintspecification ALTER COLUMN id SET DEFAULT nextval('sprintspecification_id_seq'::regclass);
5789
15951
ALTER TABLE sshkey ALTER COLUMN id SET DEFAULT nextval('sshkey_id_seq'::regclass);
5791
ALTER TABLE standardshipitrequest ALTER COLUMN id SET DEFAULT nextval('standardshipitrequest_id_seq'::regclass);
5793
ALTER TABLE staticdiff ALTER COLUMN id SET DEFAULT nextval('staticdiff_id_seq'::regclass);
5795
15954
ALTER TABLE structuralsubscription ALTER COLUMN id SET DEFAULT nextval('structuralsubscription_id_seq'::regclass);
15957
ALTER TABLE subunitstream ALTER COLUMN id SET DEFAULT nextval('subunitstream_id_seq'::regclass);
5797
15960
ALTER TABLE teammembership ALTER COLUMN id SET DEFAULT nextval('teammembership_id_seq'::regclass);
5799
15963
ALTER TABLE teamparticipation ALTER COLUMN id SET DEFAULT nextval('teamparticipation_id_seq'::regclass);
5801
15966
ALTER TABLE temporaryblobstorage ALTER COLUMN id SET DEFAULT nextval('temporaryblobstorage_id_seq'::regclass);
5803
15969
ALTER TABLE translationgroup ALTER COLUMN id SET DEFAULT nextval('translationgroup_id_seq'::regclass);
5805
15972
ALTER TABLE translationimportqueueentry ALTER COLUMN id SET DEFAULT nextval('translationimportqueueentry_id_seq'::regclass);
5807
15975
ALTER TABLE translationmessage ALTER COLUMN id SET DEFAULT nextval('translationmessage_id_seq'::regclass);
5809
15978
ALTER TABLE translationrelicensingagreement ALTER COLUMN id SET DEFAULT nextval('translationrelicensingagreement_id_seq'::regclass);
5811
15981
ALTER TABLE translationtemplateitem ALTER COLUMN id SET DEFAULT nextval('translationtemplateitem_id_seq'::regclass);
15984
ALTER TABLE translationtemplatesbuild ALTER COLUMN id SET DEFAULT nextval('translationtemplatesbuild_id_seq'::regclass);
5813
15987
ALTER TABLE translator ALTER COLUMN id SET DEFAULT nextval('translator_id_seq'::regclass);
5815
15990
ALTER TABLE usertouseremail ALTER COLUMN id SET DEFAULT nextval('usertouseremail_id_seq'::regclass);
5817
15993
ALTER TABLE vote ALTER COLUMN id SET DEFAULT nextval('vote_id_seq'::regclass);
5819
15996
ALTER TABLE votecast ALTER COLUMN id SET DEFAULT nextval('votecast_id_seq'::regclass);
5821
ALTER TABLE webserviceban ALTER COLUMN id SET DEFAULT nextval('webserviceban_id_seq'::regclass);
5823
15999
ALTER TABLE wikiname ALTER COLUMN id SET DEFAULT nextval('wikiname_id_seq'::regclass);
5825
ALTER TABLE ONLY account
5826
ADD CONSTRAINT account_openid_identifier_key UNIQUE (openid_identifier);
16002
ALTER TABLE ONLY accesspolicy
16003
ADD CONSTRAINT accesspolicy_pkey PRIMARY KEY (id);
16006
ALTER TABLE ONLY accesspolicyartifact
16007
ADD CONSTRAINT accesspolicyartifact_pkey PRIMARY KEY (id);
16010
ALTER TABLE ONLY accesspolicygrant
16011
ADD CONSTRAINT accesspolicygrant_pkey PRIMARY KEY (id);
5828
16014
ALTER TABLE ONLY account
5829
16015
ADD CONSTRAINT account_pkey PRIMARY KEY (id);
5831
16018
ALTER TABLE ONLY accountpassword
5832
16019
ADD CONSTRAINT accountpassword_account_key UNIQUE (account);
5834
16022
ALTER TABLE ONLY accountpassword
5835
16023
ADD CONSTRAINT accountpassword_pkey PRIMARY KEY (id);
5837
16026
ALTER TABLE ONLY announcement
5838
16027
ADD CONSTRAINT announcement_pkey PRIMARY KEY (id);
5840
16030
ALTER TABLE ONLY apportjob
5841
16031
ADD CONSTRAINT apportjob__job__key UNIQUE (job);
5843
16034
ALTER TABLE ONLY apportjob
5844
16035
ADD CONSTRAINT apportjob_pkey PRIMARY KEY (id);
5846
16037
ALTER TABLE apportjob CLUSTER ON apportjob_pkey;
5848
16040
ALTER TABLE ONLY archive
5849
16041
ADD CONSTRAINT archive_pkey PRIMARY KEY (id);
5851
16044
ALTER TABLE ONLY archivearch
5852
16045
ADD CONSTRAINT archivearch__processorfamily__archive__key UNIQUE (processorfamily, archive);
5854
16048
ALTER TABLE ONLY archivearch
5855
16049
ADD CONSTRAINT archivearch_pkey PRIMARY KEY (id);
5857
16052
ALTER TABLE ONLY archiveauthtoken
5858
16053
ADD CONSTRAINT archiveauthtoken_pkey PRIMARY KEY (id);
5860
16056
ALTER TABLE ONLY archiveauthtoken
5861
16057
ADD CONSTRAINT archiveauthtoken_token_key UNIQUE (token);
5863
16060
ALTER TABLE ONLY archivedependency
5864
16061
ADD CONSTRAINT archivedependency__unique UNIQUE (archive, dependency);
5866
16064
ALTER TABLE ONLY archivedependency
5867
16065
ADD CONSTRAINT archivedependency_pkey PRIMARY KEY (id);
5869
16068
ALTER TABLE ONLY archivejob
5870
16069
ADD CONSTRAINT archivejob__job__key UNIQUE (job);
5872
16072
ALTER TABLE ONLY archivejob
5873
16073
ADD CONSTRAINT archivejob_pkey PRIMARY KEY (id);
5875
16076
ALTER TABLE ONLY archivepermission
5876
16077
ADD CONSTRAINT archivepermission_pkey PRIMARY KEY (id);
5878
16080
ALTER TABLE ONLY archivesubscriber
5879
16081
ADD CONSTRAINT archivesubscriber_pkey PRIMARY KEY (id);
5881
16084
ALTER TABLE ONLY revisionauthor
5882
16085
ADD CONSTRAINT archuserid_archuserid_key UNIQUE (name);
5884
16088
ALTER TABLE ONLY revisionauthor
5885
16089
ADD CONSTRAINT archuserid_pkey PRIMARY KEY (id);
5887
ALTER TABLE ONLY authtoken
5888
ADD CONSTRAINT authtoken__token__key UNIQUE (token);
5890
ALTER TABLE ONLY authtoken
5891
ADD CONSTRAINT authtoken_pkey PRIMARY KEY (id);
5893
16092
ALTER TABLE ONLY binarypackagerelease
5894
16093
ADD CONSTRAINT binarypackage_pkey PRIMARY KEY (id);
5896
16096
ALTER TABLE ONLY binarypackagebuild
5897
16097
ADD CONSTRAINT binarypackagebuild_pkey PRIMARY KEY (id);
5899
16100
ALTER TABLE ONLY binarypackagefile
5900
16101
ADD CONSTRAINT binarypackagefile_pkey PRIMARY KEY (id);
5902
16104
ALTER TABLE ONLY binarypackagename
5903
16105
ADD CONSTRAINT binarypackagename_name_key UNIQUE (name);
5905
16108
ALTER TABLE ONLY binarypackagename
5906
16109
ADD CONSTRAINT binarypackagename_pkey PRIMARY KEY (id);
16112
ALTER TABLE ONLY binarypackagepath
16113
ADD CONSTRAINT binarypackagepath_path_key UNIQUE (path);
16116
ALTER TABLE ONLY binarypackagepath
16117
ADD CONSTRAINT binarypackagepath_pkey PRIMARY KEY (id);
5908
16120
ALTER TABLE ONLY binarypackagerelease
5909
16121
ADD CONSTRAINT binarypackagerelease_binarypackagename_key UNIQUE (binarypackagename, build, version);
5911
ALTER TABLE binarypackagerelease CLUSTER ON binarypackagerelease_binarypackagename_key;
5913
16124
ALTER TABLE ONLY binarypackagerelease
5914
16125
ADD CONSTRAINT binarypackagerelease_build_name_uniq UNIQUE (build, binarypackagename);
16128
ALTER TABLE ONLY binarypackagereleasecontents
16129
ADD CONSTRAINT binarypackagereleasecontents_pkey PRIMARY KEY (binarypackagerelease, binarypackagepath);
5916
16132
ALTER TABLE ONLY binarypackagereleasedownloadcount
5917
16133
ADD CONSTRAINT binarypackagereleasedownloadcount__archive__binary_package_rele UNIQUE (archive, binary_package_release, day, country);
5919
16136
ALTER TABLE ONLY binarypackagereleasedownloadcount
5920
16137
ADD CONSTRAINT binarypackagereleasedownloadcount_pkey PRIMARY KEY (id);
5922
ALTER TABLE ONLY bounty
5923
ADD CONSTRAINT bounty_name_key UNIQUE (name);
5925
ALTER TABLE ONLY bounty
5926
ADD CONSTRAINT bounty_pkey PRIMARY KEY (id);
5928
ALTER TABLE ONLY bountymessage
5929
ADD CONSTRAINT bountymessage_message_bounty_uniq UNIQUE (message, bounty);
5931
ALTER TABLE ONLY bountymessage
5932
ADD CONSTRAINT bountymessage_pkey PRIMARY KEY (id);
5934
ALTER TABLE ONLY bountysubscription
5935
ADD CONSTRAINT bountysubscription_person_key UNIQUE (person, bounty);
5937
ALTER TABLE ONLY bountysubscription
5938
ADD CONSTRAINT bountysubscription_pkey PRIMARY KEY (id);
5940
16140
ALTER TABLE ONLY branch
5941
16141
ADD CONSTRAINT branch__unique_name__key UNIQUE (unique_name);
5943
16144
ALTER TABLE ONLY branch
5944
16145
ADD CONSTRAINT branch_pkey PRIMARY KEY (id);
5946
16148
ALTER TABLE ONLY branch
5947
16149
ADD CONSTRAINT branch_url_unique UNIQUE (url);
5949
16152
ALTER TABLE ONLY branchjob
5950
16153
ADD CONSTRAINT branchjob_job_key UNIQUE (job);
5952
16156
ALTER TABLE ONLY branchjob
5953
16157
ADD CONSTRAINT branchjob_pkey PRIMARY KEY (id);
5955
16159
ALTER TABLE branchjob CLUSTER ON branchjob_pkey;
5957
16162
ALTER TABLE ONLY branchmergeproposal
5958
16163
ADD CONSTRAINT branchmergeproposal_pkey PRIMARY KEY (id);
5960
16166
ALTER TABLE ONLY branchmergeproposaljob
5961
16167
ADD CONSTRAINT branchmergeproposaljob_job_key UNIQUE (job);
5963
16170
ALTER TABLE ONLY branchmergeproposaljob
5964
16171
ADD CONSTRAINT branchmergeproposaljob_pkey PRIMARY KEY (id);
5966
ALTER TABLE ONLY branchmergerobot
5967
ADD CONSTRAINT branchmergerobot_name_key UNIQUE (name);
5969
ALTER TABLE ONLY branchmergerobot
5970
ADD CONSTRAINT branchmergerobot_pkey PRIMARY KEY (id);
16174
ALTER TABLE ONLY branchmergequeue
16175
ADD CONSTRAINT branchmergequeue_pkey PRIMARY KEY (id);
5972
16178
ALTER TABLE ONLY branchsubscription
5973
16179
ADD CONSTRAINT branchsubscription__person__branch__key UNIQUE (person, branch);
5975
16182
ALTER TABLE ONLY branchsubscription
5976
16183
ADD CONSTRAINT branchsubscription_pkey PRIMARY KEY (id);
5978
16186
ALTER TABLE ONLY branchvisibilitypolicy
5979
16187
ADD CONSTRAINT branchvisibilitypolicy_pkey PRIMARY KEY (id);
5981
16190
ALTER TABLE ONLY bugbranch
5982
16191
ADD CONSTRAINT bug_branch_unique UNIQUE (bug, branch);
5984
ALTER TABLE ONLY bug
5985
ADD CONSTRAINT bug_name_key UNIQUE (name);
5987
16194
ALTER TABLE ONLY bug
5988
16195
ADD CONSTRAINT bug_pkey PRIMARY KEY (id);
5990
16198
ALTER TABLE ONLY bugactivity
5991
16199
ADD CONSTRAINT bugactivity_pkey PRIMARY KEY (id);
5993
16202
ALTER TABLE ONLY bugaffectsperson
5994
16203
ADD CONSTRAINT bugaffectsperson_bug_person_uniq UNIQUE (bug, person);
5996
16206
ALTER TABLE ONLY bugaffectsperson
5997
16207
ADD CONSTRAINT bugaffectsperson_pkey PRIMARY KEY (id);
5999
16210
ALTER TABLE ONLY bugattachment
6000
16211
ADD CONSTRAINT bugattachment_pkey PRIMARY KEY (id);
6002
16214
ALTER TABLE ONLY bugbranch
6003
16215
ADD CONSTRAINT bugbranch_pkey PRIMARY KEY (id);
6005
16218
ALTER TABLE ONLY bugcve
6006
16219
ADD CONSTRAINT bugcve_bug_cve_uniq UNIQUE (bug, cve);
6008
16222
ALTER TABLE ONLY bugcve
6009
16223
ADD CONSTRAINT bugcve_pkey PRIMARY KEY (id);
6011
16226
ALTER TABLE ONLY bugjob
6012
16227
ADD CONSTRAINT bugjob__job__key UNIQUE (job);
6014
16230
ALTER TABLE ONLY bugjob
6015
16231
ADD CONSTRAINT bugjob_pkey PRIMARY KEY (id);
6017
16233
ALTER TABLE bugjob CLUSTER ON bugjob_pkey;
16236
ALTER TABLE ONLY bugmessage
16237
ADD CONSTRAINT bugmessage__bug__index__key UNIQUE (bug, index);
6019
16240
ALTER TABLE ONLY bugmessage
6020
16241
ADD CONSTRAINT bugmessage__bug__message__key UNIQUE (bug, message);
6022
16244
ALTER TABLE ONLY bugmessage
6023
16245
ADD CONSTRAINT bugmessage__bugwatch__remote_comment_id__key UNIQUE (bugwatch, remote_comment_id);
6025
16248
ALTER TABLE ONLY bugmessage
6026
16249
ADD CONSTRAINT bugmessage_pkey PRIMARY KEY (id);
16252
ALTER TABLE ONLY bugmute
16253
ADD CONSTRAINT bugmute_pkey PRIMARY KEY (person, bug);
6028
16256
ALTER TABLE ONLY bugnomination
6029
16257
ADD CONSTRAINT bugnomination_pkey PRIMARY KEY (id);
6031
16260
ALTER TABLE ONLY bugnotification
6032
16261
ADD CONSTRAINT bugnotification__bug__message__unq UNIQUE (bug, message);
6034
16264
ALTER TABLE ONLY bugnotification
6035
16265
ADD CONSTRAINT bugnotification_pkey PRIMARY KEY (id);
6037
ALTER TABLE bugnotification CLUSTER ON bugnotification_pkey;
6039
16268
ALTER TABLE ONLY bugnotificationarchive
6040
16269
ADD CONSTRAINT bugnotificationarchive__bug__message__key UNIQUE (bug, message);
6042
16272
ALTER TABLE ONLY bugnotificationarchive
6043
16273
ADD CONSTRAINT bugnotificationarchive_pk PRIMARY KEY (id);
6045
16276
ALTER TABLE ONLY bugnotificationattachment
6046
16277
ADD CONSTRAINT bugnotificationattachment_pkey PRIMARY KEY (id);
16280
ALTER TABLE ONLY bugnotificationfilter
16281
ADD CONSTRAINT bugnotificationfilter_pkey PRIMARY KEY (bug_notification, bug_subscription_filter);
6048
16284
ALTER TABLE ONLY bugnotificationrecipient
6049
16285
ADD CONSTRAINT bugnotificationrecipient__bug_notificaion__person__key UNIQUE (bug_notification, person);
6051
16288
ALTER TABLE ONLY bugnotificationrecipient
6052
16289
ADD CONSTRAINT bugnotificationrecipient_pkey PRIMARY KEY (id);
6054
16292
ALTER TABLE ONLY bugnotificationrecipientarchive
6055
16293
ADD CONSTRAINT bugnotificationrecipientarchive_pk PRIMARY KEY (id);
6057
ALTER TABLE ONLY bugpackageinfestation
6058
ADD CONSTRAINT bugpackageinfestation_bug_key UNIQUE (bug, sourcepackagerelease);
6060
ALTER TABLE ONLY bugpackageinfestation
6061
ADD CONSTRAINT bugpackageinfestation_pkey PRIMARY KEY (id);
6063
ALTER TABLE ONLY bugproductinfestation
6064
ADD CONSTRAINT bugproductinfestation_bug_key UNIQUE (bug, productrelease);
6066
ALTER TABLE ONLY bugproductinfestation
6067
ADD CONSTRAINT bugproductinfestation_pkey PRIMARY KEY (id);
6069
16296
ALTER TABLE ONLY bugsubscription
6070
16297
ADD CONSTRAINT bugsubscription_pkey PRIMARY KEY (id);
16300
ALTER TABLE ONLY bugsubscriptionfilter
16301
ADD CONSTRAINT bugsubscriptionfilter_pkey PRIMARY KEY (id);
16304
ALTER TABLE ONLY bugsubscriptionfilterimportance
16305
ADD CONSTRAINT bugsubscriptionfilterimportance_pkey PRIMARY KEY (id);
16308
ALTER TABLE ONLY bugsubscriptionfiltermute
16309
ADD CONSTRAINT bugsubscriptionfiltermute_pkey PRIMARY KEY (person, filter);
16312
ALTER TABLE ONLY bugsubscriptionfilterstatus
16313
ADD CONSTRAINT bugsubscriptionfilterstatus_pkey PRIMARY KEY (id);
16316
ALTER TABLE ONLY bugsubscriptionfiltertag
16317
ADD CONSTRAINT bugsubscriptionfiltertag_pkey PRIMARY KEY (id);
16320
ALTER TABLE ONLY bugsummary
16321
ADD CONSTRAINT bugsummary_pkey PRIMARY KEY (id);
16324
ALTER TABLE ONLY bugsummaryjournal
16325
ADD CONSTRAINT bugsummaryjournal_pkey PRIMARY KEY (id);
6072
16328
ALTER TABLE ONLY bugtracker
6073
16329
ADD CONSTRAINT bugsystem_pkey PRIMARY KEY (id);
6075
16332
ALTER TABLE ONLY bugtag
6076
16333
ADD CONSTRAINT bugtag__tag__bug__key UNIQUE (tag, bug);
6078
16336
ALTER TABLE ONLY bugtag
6079
16337
ADD CONSTRAINT bugtag_pkey PRIMARY KEY (id);
6081
16340
ALTER TABLE ONLY bugtask
6082
16341
ADD CONSTRAINT bugtask_pkey PRIMARY KEY (id);
6084
16344
ALTER TABLE ONLY bugtrackeralias
6085
16345
ADD CONSTRAINT bugtracker__base_url__key UNIQUE (base_url);
6087
16348
ALTER TABLE ONLY bugtrackeralias
6088
16349
ADD CONSTRAINT bugtrackeralias_pkey PRIMARY KEY (id);
16352
ALTER TABLE ONLY bugtrackercomponent
16353
ADD CONSTRAINT bugtrackercomponent__component_group__name__key UNIQUE (component_group, name);
16356
ALTER TABLE ONLY bugtrackercomponent
16357
ADD CONSTRAINT bugtrackercomponent__disto__spn__key UNIQUE (distribution, source_package_name);
16360
ALTER TABLE ONLY bugtrackercomponent
16361
ADD CONSTRAINT bugtrackercomponent_pkey PRIMARY KEY (id);
16364
ALTER TABLE ONLY bugtrackercomponentgroup
16365
ADD CONSTRAINT bugtrackercomponentgroup__bug_tracker__name__key UNIQUE (bug_tracker, name);
16368
ALTER TABLE ONLY bugtrackercomponentgroup
16369
ADD CONSTRAINT bugtrackercomponentgroup_pkey PRIMARY KEY (id);
6090
16372
ALTER TABLE ONLY bugtrackerperson
6091
16373
ADD CONSTRAINT bugtrackerperson__bugtracker__name__key UNIQUE (bugtracker, name);
6093
16376
ALTER TABLE ONLY bugtrackerperson
6094
16377
ADD CONSTRAINT bugtrackerperson_pkey PRIMARY KEY (id);
6096
16380
ALTER TABLE ONLY bugwatch
6097
16381
ADD CONSTRAINT bugwatch_bugtask_target UNIQUE (id, bug);
6099
16384
ALTER TABLE ONLY bugwatch
6100
16385
ADD CONSTRAINT bugwatch_pkey PRIMARY KEY (id);
6102
16388
ALTER TABLE ONLY bugwatchactivity
6103
16389
ADD CONSTRAINT bugwatchactivity_pkey PRIMARY KEY (id);
6105
16392
ALTER TABLE ONLY builder
6106
16393
ADD CONSTRAINT builder_pkey PRIMARY KEY (id);
6108
16396
ALTER TABLE ONLY builder
6109
16397
ADD CONSTRAINT builder_url_key UNIQUE (url);
6111
16400
ALTER TABLE ONLY buildfarmjob
6112
16401
ADD CONSTRAINT buildfarmjob_pkey PRIMARY KEY (id);
6114
16404
ALTER TABLE ONLY buildpackagejob
6115
16405
ADD CONSTRAINT buildpackagejob__build__key UNIQUE (build);
6117
16408
ALTER TABLE ONLY buildpackagejob
6118
16409
ADD CONSTRAINT buildpackagejob__job__key UNIQUE (job);
6120
16412
ALTER TABLE ONLY buildpackagejob
6121
16413
ADD CONSTRAINT buildpackagejob_pkey PRIMARY KEY (id);
6123
16416
ALTER TABLE ONLY buildqueue
6124
16417
ADD CONSTRAINT buildqueue__job__key UNIQUE (job);
6126
16420
ALTER TABLE ONLY buildqueue
6127
16421
ADD CONSTRAINT buildqueue_pkey PRIMARY KEY (id);
6129
16424
ALTER TABLE ONLY revision
6130
16425
ADD CONSTRAINT changeset_pkey PRIMARY KEY (id);
6132
16428
ALTER TABLE ONLY codeimport
6133
16429
ADD CONSTRAINT codeimport_branch_key UNIQUE (branch);
6135
16432
ALTER TABLE ONLY codeimport
6136
16433
ADD CONSTRAINT codeimport_pkey PRIMARY KEY (id);
6138
16436
ALTER TABLE ONLY codeimportevent
6139
16437
ADD CONSTRAINT codeimportevent_pkey PRIMARY KEY (id);
6141
16440
ALTER TABLE ONLY codeimporteventdata
6142
16441
ADD CONSTRAINT codeimporteventdata__event__data_type__key UNIQUE (event, data_type);
6144
16444
ALTER TABLE ONLY codeimporteventdata
6145
16445
ADD CONSTRAINT codeimporteventdata_pkey PRIMARY KEY (id);
6147
16448
ALTER TABLE ONLY codeimportjob
6148
16449
ADD CONSTRAINT codeimportjob__code_import__key UNIQUE (code_import);
6150
16452
ALTER TABLE ONLY codeimportjob
6151
16453
ADD CONSTRAINT codeimportjob_pkey PRIMARY KEY (id);
6153
16456
ALTER TABLE ONLY codeimportmachine
6154
16457
ADD CONSTRAINT codeimportmachine_hostname_key UNIQUE (hostname);
6156
16460
ALTER TABLE ONLY codeimportmachine
6157
16461
ADD CONSTRAINT codeimportmachine_pkey PRIMARY KEY (id);
6159
16464
ALTER TABLE ONLY codeimportresult
6160
16465
ADD CONSTRAINT codeimportresult_pkey PRIMARY KEY (id);
6162
16468
ALTER TABLE ONLY codereviewmessage
6163
16469
ADD CONSTRAINT codereviewmessage__branch_merge_proposal__id_key UNIQUE (branch_merge_proposal, id);
6165
16472
ALTER TABLE ONLY codereviewmessage
6166
16473
ADD CONSTRAINT codereviewmessage_message_key UNIQUE (message);
6168
16476
ALTER TABLE ONLY codereviewmessage
6169
16477
ADD CONSTRAINT codereviewmessage_pkey PRIMARY KEY (id);
6171
16480
ALTER TABLE ONLY codereviewvote
6172
16481
ADD CONSTRAINT codereviewvote_pkey PRIMARY KEY (id);
6174
16484
ALTER TABLE ONLY commercialsubscription
6175
16485
ADD CONSTRAINT commercialsubscription_pkey PRIMARY KEY (id);
6177
16488
ALTER TABLE ONLY component
6178
16489
ADD CONSTRAINT component_name_key UNIQUE (name);
6180
16492
ALTER TABLE ONLY component
6181
16493
ADD CONSTRAINT component_pkey PRIMARY KEY (id);
6183
16496
ALTER TABLE ONLY componentselection
6184
16497
ADD CONSTRAINT componentselection__distroseries__component__key UNIQUE (distroseries, component);
6186
16500
ALTER TABLE ONLY componentselection
6187
16501
ADD CONSTRAINT componentselection_pkey PRIMARY KEY (id);
6189
16504
ALTER TABLE ONLY continent
6190
16505
ADD CONSTRAINT continent_code_key UNIQUE (code);
6192
16508
ALTER TABLE ONLY continent
6193
16509
ADD CONSTRAINT continent_name_key UNIQUE (name);
6195
16512
ALTER TABLE ONLY continent
6196
16513
ADD CONSTRAINT continent_pkey PRIMARY KEY (id);
6198
16516
ALTER TABLE ONLY country
6199
16517
ADD CONSTRAINT country_code2_uniq UNIQUE (iso3166code2);
6201
16520
ALTER TABLE ONLY country
6202
16521
ADD CONSTRAINT country_code3_uniq UNIQUE (iso3166code3);
6204
16524
ALTER TABLE ONLY country
6205
16525
ADD CONSTRAINT country_name_uniq UNIQUE (name);
6207
16528
ALTER TABLE ONLY country
6208
16529
ADD CONSTRAINT country_pkey PRIMARY KEY (id);
6210
16532
ALTER TABLE ONLY customlanguagecode
6211
16533
ADD CONSTRAINT customlanguagecode_pkey PRIMARY KEY (id);
6213
16536
ALTER TABLE ONLY cve
6214
16537
ADD CONSTRAINT cve_pkey PRIMARY KEY (id);
6216
16540
ALTER TABLE ONLY cve
6217
16541
ADD CONSTRAINT cve_sequence_uniq UNIQUE (sequence);
6219
16544
ALTER TABLE ONLY cvereference
6220
16545
ADD CONSTRAINT cvereference_pkey PRIMARY KEY (id);
6222
16548
ALTER TABLE ONLY databasecpustats
6223
16549
ADD CONSTRAINT databasecpustats_pkey PRIMARY KEY (date_created, username);
16552
ALTER TABLE ONLY databasediskutilization
16553
ADD CONSTRAINT databasediskutilization_pkey PRIMARY KEY (date_created, sort);
6225
16556
ALTER TABLE ONLY databasereplicationlag
6226
16557
ADD CONSTRAINT databasereplicationlag_pkey PRIMARY KEY (node);
6228
16560
ALTER TABLE ONLY databasetablestats
6229
16561
ADD CONSTRAINT databasetablestats_pkey PRIMARY KEY (date_created, schemaname, relname);
6231
16563
ALTER TABLE databasetablestats CLUSTER ON databasetablestats_pkey;
6233
16566
ALTER TABLE ONLY diff
6234
16567
ADD CONSTRAINT diff_pkey PRIMARY KEY (id);
6236
16570
ALTER TABLE ONLY distribution
6237
16571
ADD CONSTRAINT distribution_name_key UNIQUE (name);
6239
16574
ALTER TABLE ONLY distribution
6240
16575
ADD CONSTRAINT distribution_pkey PRIMARY KEY (id);
6242
ALTER TABLE ONLY distributionbounty
6243
ADD CONSTRAINT distributionbounty_bounty_distribution_uniq UNIQUE (bounty, distribution);
6245
ALTER TABLE ONLY distributionbounty
6246
ADD CONSTRAINT distributionbounty_pkey PRIMARY KEY (id);
16578
ALTER TABLE ONLY distributionjob
16579
ADD CONSTRAINT distributionjob__job__key UNIQUE (job);
16582
ALTER TABLE ONLY distributionjob
16583
ADD CONSTRAINT distributionjob_pkey PRIMARY KEY (id);
6248
16586
ALTER TABLE ONLY distributionmirror
6249
16587
ADD CONSTRAINT distributionmirror_ftp_base_url_key UNIQUE (ftp_base_url);
6251
16590
ALTER TABLE ONLY distributionmirror
6252
16591
ADD CONSTRAINT distributionmirror_http_base_url_key UNIQUE (http_base_url);
6254
16594
ALTER TABLE ONLY distributionmirror
6255
16595
ADD CONSTRAINT distributionmirror_name_key UNIQUE (name);
6257
16598
ALTER TABLE ONLY distributionmirror
6258
16599
ADD CONSTRAINT distributionmirror_pkey PRIMARY KEY (id);
6260
16602
ALTER TABLE ONLY distributionmirror
6261
16603
ADD CONSTRAINT distributionmirror_rsync_base_url_key UNIQUE (rsync_base_url);
6263
16606
ALTER TABLE ONLY distributionsourcepackage
6264
16607
ADD CONSTRAINT distributionpackage__sourcepackagename__distribution__key UNIQUE (sourcepackagename, distribution);
6266
16609
ALTER TABLE distributionsourcepackage CLUSTER ON distributionpackage__sourcepackagename__distribution__key;
6268
16612
ALTER TABLE ONLY distributionsourcepackage
6269
16613
ADD CONSTRAINT distributionsourcepackage_pkey PRIMARY KEY (id);
6271
16616
ALTER TABLE ONLY distributionsourcepackagecache
6272
16617
ADD CONSTRAINT distributionsourcepackagecache__distribution__sourcepackagename UNIQUE (distribution, sourcepackagename, archive);
6274
16620
ALTER TABLE ONLY distributionsourcepackagecache
6275
16621
ADD CONSTRAINT distributionsourcepackagecache_pkey PRIMARY KEY (id);
6277
16624
ALTER TABLE ONLY distroarchseries
6278
16625
ADD CONSTRAINT distroarchrelease_pkey PRIMARY KEY (id);
6280
16628
ALTER TABLE ONLY distroarchseries
6281
16629
ADD CONSTRAINT distroarchseries__architecturetag__distroseries__key UNIQUE (architecturetag, distroseries);
6283
16632
ALTER TABLE ONLY distroarchseries
6284
16633
ADD CONSTRAINT distroarchseries__processorfamily__distroseries__key UNIQUE (processorfamily, distroseries);
6286
ALTER TABLE ONLY distrocomponentuploader
6287
ADD CONSTRAINT distrocomponentuploader_distro_component_uniq UNIQUE (distribution, component);
6289
ALTER TABLE ONLY distrocomponentuploader
6290
ADD CONSTRAINT distrocomponentuploader_pkey PRIMARY KEY (id);
6292
ALTER TABLE ONLY distroseries
6293
ADD CONSTRAINT distrorelease_distribution_key UNIQUE (distribution, name);
6295
ALTER TABLE ONLY distroseries
6296
ADD CONSTRAINT distrorelease_distro_release_unique UNIQUE (distribution, id);
16636
ALTER TABLE ONLY distroseries
16637
ADD CONSTRAINT distrorelease__distribution__name__key UNIQUE (distribution, name);
6298
16640
ALTER TABLE ONLY distroseries
6299
16641
ADD CONSTRAINT distrorelease_pkey PRIMARY KEY (id);
6301
16644
ALTER TABLE ONLY distroserieslanguage
6302
16645
ADD CONSTRAINT distroreleaselanguage_distrorelease_language_uniq UNIQUE (distroseries, language);
6304
16648
ALTER TABLE ONLY distroserieslanguage
6305
16649
ADD CONSTRAINT distroreleaselanguage_pkey PRIMARY KEY (id);
6307
16652
ALTER TABLE ONLY distroseriespackagecache
6308
16653
ADD CONSTRAINT distroreleasepackagecache_pkey PRIMARY KEY (id);
6310
16656
ALTER TABLE ONLY packageupload
6311
16657
ADD CONSTRAINT distroreleasequeue_pkey PRIMARY KEY (id);
6313
16660
ALTER TABLE ONLY packageuploadbuild
6314
16661
ADD CONSTRAINT distroreleasequeuebuild__distroreleasequeue__build__unique UNIQUE (packageupload, build);
6316
16664
ALTER TABLE ONLY packageuploadbuild
6317
16665
ADD CONSTRAINT distroreleasequeuebuild_pkey PRIMARY KEY (id);
6319
16668
ALTER TABLE ONLY packageuploadcustom
6320
16669
ADD CONSTRAINT distroreleasequeuecustom_pkey PRIMARY KEY (id);
6322
16672
ALTER TABLE ONLY packageuploadsource
6323
16673
ADD CONSTRAINT distroreleasequeuesource_pkey PRIMARY KEY (id);
16676
ALTER TABLE ONLY distroseries
16677
ADD CONSTRAINT distroseries__distribution__id__key UNIQUE (distribution, id);
16680
ALTER TABLE ONLY distroseriesdifference
16681
ADD CONSTRAINT distroseriesdifference__derived_series__parent_series__source_p UNIQUE (derived_series, parent_series, source_package_name);
16684
ALTER TABLE ONLY distroseriesdifference
16685
ADD CONSTRAINT distroseriesdifference_pkey PRIMARY KEY (id);
16688
ALTER TABLE ONLY distroseriesdifferencemessage
16689
ADD CONSTRAINT distroseriesdifferencemessage_message_key UNIQUE (message);
16692
ALTER TABLE ONLY distroseriesdifferencemessage
16693
ADD CONSTRAINT distroseriesdifferencemessage_pkey PRIMARY KEY (id);
6325
16696
ALTER TABLE ONLY distroseriespackagecache
6326
16697
ADD CONSTRAINT distroseriespackagecache__distroseries__binarypackagename__arch UNIQUE (distroseries, binarypackagename, archive);
16700
ALTER TABLE ONLY distroseriesparent
16701
ADD CONSTRAINT distroseriesparent_pkey PRIMARY KEY (id);
6328
16704
ALTER TABLE ONLY emailaddress
6329
16705
ADD CONSTRAINT emailaddress_pkey PRIMARY KEY (id);
6331
16708
ALTER TABLE ONLY entitlement
6332
16709
ADD CONSTRAINT entitlement_pkey PRIMARY KEY (id);
6334
16712
ALTER TABLE ONLY faq
6335
16713
ADD CONSTRAINT faq_pkey PRIMARY KEY (id);
6337
16716
ALTER TABLE ONLY featureflag
6338
16717
ADD CONSTRAINT feature_flag_pkey PRIMARY KEY (scope, flag);
6340
16720
ALTER TABLE ONLY featureflag
6341
16721
ADD CONSTRAINT feature_flag_unique_priority_per_flag UNIQUE (flag, priority);
6343
16724
ALTER TABLE ONLY featuredproject
6344
16725
ADD CONSTRAINT featuredproject_pkey PRIMARY KEY (id);
16728
ALTER TABLE ONLY featureflagchangelogentry
16729
ADD CONSTRAINT featureflagchangelogentry_pkey PRIMARY KEY (id);
6346
16732
ALTER TABLE ONLY flatpackagesetinclusion
6347
16733
ADD CONSTRAINT flatpackagesetinclusion__parent__child__key UNIQUE (parent, child);
6349
16736
ALTER TABLE ONLY flatpackagesetinclusion
6350
16737
ADD CONSTRAINT flatpackagesetinclusion_pkey PRIMARY KEY (id);
6352
16740
ALTER TABLE ONLY fticache
6353
16741
ADD CONSTRAINT fticache_pkey PRIMARY KEY (id);
6355
16744
ALTER TABLE ONLY fticache
6356
16745
ADD CONSTRAINT fticache_tablename_key UNIQUE (tablename);
6358
16748
ALTER TABLE ONLY gpgkey
6359
16749
ADD CONSTRAINT gpgkey_fingerprint_key UNIQUE (fingerprint);
6361
16752
ALTER TABLE ONLY gpgkey
6362
16753
ADD CONSTRAINT gpgkey_owner_key UNIQUE (owner, id);
6364
16756
ALTER TABLE ONLY gpgkey
6365
16757
ADD CONSTRAINT gpgkey_pkey PRIMARY KEY (id);
6367
16760
ALTER TABLE ONLY hwdevice
6368
16761
ADD CONSTRAINT hwdevice__bus_vendor_id__bus_product_id__variant__key UNIQUE (bus_vendor_id, bus_product_id, variant);
6370
16764
ALTER TABLE ONLY hwdevice
6371
16765
ADD CONSTRAINT hwdevice_pkey PRIMARY KEY (id);
6373
16768
ALTER TABLE ONLY hwdeviceclass
6374
16769
ADD CONSTRAINT hwdeviceclass_pkey PRIMARY KEY (id);
6376
16772
ALTER TABLE ONLY hwdevicedriverlink
6377
16773
ADD CONSTRAINT hwdevicedriverlink_pkey PRIMARY KEY (id);
6379
16776
ALTER TABLE ONLY hwdevicenamevariant
6380
16777
ADD CONSTRAINT hwdevicenamevariant__vendor_name__product_name__device__key UNIQUE (vendor_name, product_name, device);
6382
16780
ALTER TABLE ONLY hwdevicenamevariant
6383
16781
ADD CONSTRAINT hwdevicenamevariant_pkey PRIMARY KEY (id);
6385
16784
ALTER TABLE ONLY hwdmihandle
6386
16785
ADD CONSTRAINT hwdmihandle_pkey PRIMARY KEY (id);
6388
16788
ALTER TABLE ONLY hwdmivalue
6389
16789
ADD CONSTRAINT hwdmivalue_pkey PRIMARY KEY (id);
6391
16792
ALTER TABLE ONLY hwdriver
6392
16793
ADD CONSTRAINT hwdriver__package_name__name__key UNIQUE (package_name, name);
6394
16796
ALTER TABLE ONLY hwdriver
6395
16797
ADD CONSTRAINT hwdriver_pkey PRIMARY KEY (id);
6397
16800
ALTER TABLE ONLY hwsubmission
6398
16801
ADD CONSTRAINT hwsubmission__submission_key__key UNIQUE (submission_key);
6400
16804
ALTER TABLE ONLY hwsubmission
6401
16805
ADD CONSTRAINT hwsubmission_pkey PRIMARY KEY (id);
6403
16808
ALTER TABLE ONLY hwsubmissionbug
6404
16809
ADD CONSTRAINT hwsubmissionbug__submission__bug__key UNIQUE (submission, bug);
6406
16812
ALTER TABLE ONLY hwsubmissionbug
6407
16813
ADD CONSTRAINT hwsubmissionbug_pkey PRIMARY KEY (id);
6409
16816
ALTER TABLE ONLY hwsubmissiondevice
6410
16817
ADD CONSTRAINT hwsubmissiondevice_pkey PRIMARY KEY (id);
6412
16820
ALTER TABLE ONLY hwsystemfingerprint
6413
16821
ADD CONSTRAINT hwsystemfingerprint__fingerprint__key UNIQUE (fingerprint);
6415
16824
ALTER TABLE ONLY hwsystemfingerprint
6416
16825
ADD CONSTRAINT hwsystemfingerprint_pkey PRIMARY KEY (id);
6418
16828
ALTER TABLE ONLY hwtest
6419
16829
ADD CONSTRAINT hwtest_pkey PRIMARY KEY (id);
6421
16832
ALTER TABLE ONLY hwtestanswer
6422
16833
ADD CONSTRAINT hwtestanswer_pkey PRIMARY KEY (id);
6424
16836
ALTER TABLE ONLY hwtestanswerchoice
6425
16837
ADD CONSTRAINT hwtestanswerchoice__choice__test__key UNIQUE (choice, test);
6427
16840
ALTER TABLE ONLY hwtestanswerchoice
6428
16841
ADD CONSTRAINT hwtestanswerchoice__test__id__key UNIQUE (test, id);
6430
16844
ALTER TABLE ONLY hwtestanswerchoice
6431
16845
ADD CONSTRAINT hwtestanswerchoice_pkey PRIMARY KEY (id);
6433
16848
ALTER TABLE ONLY hwtestanswercount
6434
16849
ADD CONSTRAINT hwtestanswercount_pkey PRIMARY KEY (id);
6436
16852
ALTER TABLE ONLY hwtestanswercountdevice
6437
16853
ADD CONSTRAINT hwtestanswercountdevice__answer__device_driver__key UNIQUE (answer, device_driver);
6439
16856
ALTER TABLE ONLY hwtestanswercountdevice
6440
16857
ADD CONSTRAINT hwtestanswercountdevice_pkey PRIMARY KEY (id);
6442
16860
ALTER TABLE ONLY hwtestanswerdevice
6443
16861
ADD CONSTRAINT hwtestanswerdevice__answer__device_driver__key UNIQUE (answer, device_driver);
6445
16864
ALTER TABLE ONLY hwtestanswerdevice
6446
16865
ADD CONSTRAINT hwtestanswerdevice_pkey PRIMARY KEY (id);
6448
16868
ALTER TABLE ONLY hwvendorid
6449
16869
ADD CONSTRAINT hwvendorid__bus_vendor_id__vendor_name__key UNIQUE (bus, vendor_id_for_bus, vendor_name);
6451
16872
ALTER TABLE ONLY hwvendorid
6452
16873
ADD CONSTRAINT hwvendorid_pkey PRIMARY KEY (id);
6454
16876
ALTER TABLE ONLY hwvendorname
6455
16877
ADD CONSTRAINT hwvendorname_pkey PRIMARY KEY (id);
16880
ALTER TABLE ONLY incrementaldiff
16881
ADD CONSTRAINT incrementaldiff_pkey PRIMARY KEY (id);
6457
16884
ALTER TABLE ONLY ircid
6458
16885
ADD CONSTRAINT ircid_pkey PRIMARY KEY (id);
6460
16888
ALTER TABLE ONLY jabberid
6461
16889
ADD CONSTRAINT jabberid_jabberid_key UNIQUE (jabberid);
6463
16892
ALTER TABLE ONLY jabberid
6464
16893
ADD CONSTRAINT jabberid_pkey PRIMARY KEY (id);
6466
16896
ALTER TABLE ONLY job
6467
16897
ADD CONSTRAINT job__status__id__key UNIQUE (status, id);
6469
16900
ALTER TABLE ONLY job
6470
16901
ADD CONSTRAINT job_pkey PRIMARY KEY (id);
6472
16903
ALTER TABLE job CLUSTER ON job_pkey;
6474
16906
ALTER TABLE ONLY karma
6475
16907
ADD CONSTRAINT karma_pkey PRIMARY KEY (id);
6477
16910
ALTER TABLE ONLY karmaaction
6478
16911
ADD CONSTRAINT karmaaction_name_uniq UNIQUE (name);
6480
16914
ALTER TABLE ONLY karmaaction
6481
16915
ADD CONSTRAINT karmaaction_pkey PRIMARY KEY (id);
6483
16918
ALTER TABLE ONLY karmacache
6484
16919
ADD CONSTRAINT karmacache_pkey PRIMARY KEY (id);
6486
16922
ALTER TABLE ONLY karmacategory
6487
16923
ADD CONSTRAINT karmacategory_pkey PRIMARY KEY (id);
6489
16926
ALTER TABLE ONLY karmatotalcache
6490
16927
ADD CONSTRAINT karmatotalcache_person_key UNIQUE (person);
6492
16930
ALTER TABLE ONLY karmatotalcache
6493
16931
ADD CONSTRAINT karmatotalcache_pkey PRIMARY KEY (id);
6495
16934
ALTER TABLE ONLY language
6496
16935
ADD CONSTRAINT language_code_key UNIQUE (code);
6498
16938
ALTER TABLE ONLY language
6499
16939
ADD CONSTRAINT language_pkey PRIMARY KEY (id);
6501
16942
ALTER TABLE ONLY languagepack
6502
16943
ADD CONSTRAINT languagepack_pkey PRIMARY KEY (id);
6504
16946
ALTER TABLE ONLY launchpaddatabaserevision
6505
16947
ADD CONSTRAINT launchpaddatabaserevision_pkey PRIMARY KEY (major, minor, patch);
16950
ALTER TABLE ONLY launchpaddatabaseupdatelog
16951
ADD CONSTRAINT launchpaddatabaseupdatelog_pkey PRIMARY KEY (id);
6507
16954
ALTER TABLE ONLY launchpadstatistic
6508
16955
ADD CONSTRAINT launchpadstatistic_pkey PRIMARY KEY (id);
6510
16958
ALTER TABLE ONLY launchpadstatistic
6511
16959
ADD CONSTRAINT launchpadstatistics_uniq_name UNIQUE (name);
6513
16962
ALTER TABLE ONLY libraryfilealias
6514
16963
ADD CONSTRAINT libraryfilealias_pkey PRIMARY KEY (id);
6516
16965
ALTER TABLE libraryfilealias CLUSTER ON libraryfilealias_pkey;
6518
16968
ALTER TABLE ONLY libraryfilecontent
6519
16969
ADD CONSTRAINT libraryfilecontent_pkey PRIMARY KEY (id);
6521
16971
ALTER TABLE libraryfilecontent CLUSTER ON libraryfilecontent_pkey;
6523
16974
ALTER TABLE ONLY libraryfiledownloadcount
6524
16975
ADD CONSTRAINT libraryfiledownloadcount__libraryfilealias__day__country__key UNIQUE (libraryfilealias, day, country);
6526
16978
ALTER TABLE ONLY libraryfiledownloadcount
6527
16979
ADD CONSTRAINT libraryfiledownloadcount_pkey PRIMARY KEY (id);
6529
16982
ALTER TABLE ONLY logintoken
6530
16983
ADD CONSTRAINT logintoken_pkey PRIMARY KEY (id);
6532
16986
ALTER TABLE ONLY logintoken
6533
16987
ADD CONSTRAINT logintoken_token_key UNIQUE (token);
6535
16990
ALTER TABLE ONLY lp_account
6536
16991
ADD CONSTRAINT lp_account__openid_identifier__key UNIQUE (openid_identifier);
6538
16994
ALTER TABLE ONLY lp_account
6539
16995
ADD CONSTRAINT lp_account_pkey PRIMARY KEY (id);
16998
ALTER TABLE ONLY lp_openididentifier
16999
ADD CONSTRAINT lp_openididentifier_pkey PRIMARY KEY (identifier);
6541
17002
ALTER TABLE ONLY lp_person
6542
17003
ADD CONSTRAINT lp_person__account__key UNIQUE (account);
6544
17006
ALTER TABLE ONLY lp_person
6545
17007
ADD CONSTRAINT lp_person__name__key UNIQUE (name);
6547
17010
ALTER TABLE ONLY lp_person
6548
17011
ADD CONSTRAINT lp_person_pkey PRIMARY KEY (id);
6550
17014
ALTER TABLE ONLY lp_personlocation
6551
17015
ADD CONSTRAINT lp_personlocation__person__key UNIQUE (person);
6553
17018
ALTER TABLE ONLY lp_personlocation
6554
17019
ADD CONSTRAINT lp_personlocation_pkey PRIMARY KEY (id);
6556
17022
ALTER TABLE ONLY lp_teamparticipation
6557
17023
ADD CONSTRAINT lp_teamparticipation_pkey PRIMARY KEY (id);
6559
17026
ALTER TABLE ONLY lp_teamparticipation
6560
17027
ADD CONSTRAINT lp_teamperticipation__team__person__key UNIQUE (team, person);
6562
17030
ALTER TABLE ONLY mailinglist
6563
17031
ADD CONSTRAINT mailinglist_pkey PRIMARY KEY (id);
6565
17034
ALTER TABLE ONLY mailinglist
6566
17035
ADD CONSTRAINT mailinglist_team_key UNIQUE (team);
6568
ALTER TABLE ONLY mailinglistban
6569
ADD CONSTRAINT mailinglistban_pkey PRIMARY KEY (id);
6571
17038
ALTER TABLE ONLY mailinglistsubscription
6572
17039
ADD CONSTRAINT mailinglistsubscription_pkey PRIMARY KEY (id);
6574
17042
ALTER TABLE ONLY teammembership
6575
17043
ADD CONSTRAINT membership_person_key UNIQUE (person, team);
6577
17046
ALTER TABLE ONLY teammembership
6578
17047
ADD CONSTRAINT membership_pkey PRIMARY KEY (id);
6580
ALTER TABLE ONLY mentoringoffer
6581
ADD CONSTRAINT mentoringoffer_pkey PRIMARY KEY (id);
6583
17050
ALTER TABLE ONLY mergedirectivejob
6584
17051
ADD CONSTRAINT mergedirectivejob_job_key UNIQUE (job);
6586
17054
ALTER TABLE ONLY mergedirectivejob
6587
17055
ADD CONSTRAINT mergedirectivejob_pkey PRIMARY KEY (id);
6589
17058
ALTER TABLE ONLY message
6590
17059
ADD CONSTRAINT message_pkey PRIMARY KEY (id);
17061
ALTER TABLE message CLUSTER ON message_pkey;
6592
17064
ALTER TABLE ONLY messageapproval
6593
17065
ADD CONSTRAINT messageapproval_pkey PRIMARY KEY (id);
6595
17068
ALTER TABLE ONLY messagechunk
6596
17069
ADD CONSTRAINT messagechunk_message_idx UNIQUE (message, sequence);
6598
17072
ALTER TABLE ONLY messagechunk
6599
17073
ADD CONSTRAINT messagechunk_pkey PRIMARY KEY (id);
6601
17076
ALTER TABLE ONLY milestone
6602
17077
ADD CONSTRAINT milestone_distribution_id_key UNIQUE (distribution, id);
6604
17080
ALTER TABLE ONLY milestone
6605
17081
ADD CONSTRAINT milestone_name_distribution_key UNIQUE (name, distribution);
6607
17084
ALTER TABLE ONLY milestone
6608
17085
ADD CONSTRAINT milestone_name_product_key UNIQUE (name, product);
6610
17088
ALTER TABLE ONLY milestone
6611
17089
ADD CONSTRAINT milestone_pkey PRIMARY KEY (id);
6613
17091
ALTER TABLE milestone CLUSTER ON milestone_pkey;
6615
17094
ALTER TABLE ONLY milestone
6616
17095
ADD CONSTRAINT milestone_product_id_key UNIQUE (product, id);
6618
17098
ALTER TABLE ONLY mirror
6619
17099
ADD CONSTRAINT mirror_name_key UNIQUE (name);
6621
17102
ALTER TABLE ONLY mirror
6622
17103
ADD CONSTRAINT mirror_pkey PRIMARY KEY (id);
6624
17106
ALTER TABLE ONLY mirrorcdimagedistroseries
6625
17107
ADD CONSTRAINT mirrorcdimagedistrorelease_pkey PRIMARY KEY (id);
6627
17110
ALTER TABLE ONLY mirrorcdimagedistroseries
6628
17111
ADD CONSTRAINT mirrorcdimagedistroseries__unq UNIQUE (distroseries, flavour, distribution_mirror);
6630
17114
ALTER TABLE ONLY mirrorcontent
6631
17115
ADD CONSTRAINT mirrorcontent_pkey PRIMARY KEY (id);
6633
17118
ALTER TABLE ONLY mirrordistroarchseries
6634
17119
ADD CONSTRAINT mirrordistroarchrelease_pkey PRIMARY KEY (id);
6636
17122
ALTER TABLE ONLY mirrordistroseriessource
6637
17123
ADD CONSTRAINT mirrordistroreleasesource_pkey PRIMARY KEY (id);
6639
17126
ALTER TABLE ONLY mirrorproberecord
6640
17127
ADD CONSTRAINT mirrorproberecord_pkey PRIMARY KEY (id);
6642
17130
ALTER TABLE ONLY mirrorsourcecontent
6643
17131
ADD CONSTRAINT mirrorsourcecontent_pkey PRIMARY KEY (id);
6645
17134
ALTER TABLE ONLY nameblacklist
6646
17135
ADD CONSTRAINT nameblacklist__regexp__key UNIQUE (regexp);
6648
17138
ALTER TABLE ONLY nameblacklist
6649
17139
ADD CONSTRAINT nameblacklist_pkey PRIMARY KEY (id);
6651
17142
ALTER TABLE ONLY oauthaccesstoken
6652
17143
ADD CONSTRAINT oauthaccesstoken_key_key UNIQUE (key);
6654
17146
ALTER TABLE ONLY oauthaccesstoken
6655
17147
ADD CONSTRAINT oauthaccesstoken_pkey PRIMARY KEY (id);
6657
17150
ALTER TABLE ONLY oauthconsumer
6658
17151
ADD CONSTRAINT oauthconsumer_key_key UNIQUE (key);
6660
17154
ALTER TABLE ONLY oauthconsumer
6661
17155
ADD CONSTRAINT oauthconsumer_pkey PRIMARY KEY (id);
6663
ALTER TABLE ONLY oauthnonce
6664
ADD CONSTRAINT oauthnonce__access_token__request_timestamp__nonce__key UNIQUE (access_token, request_timestamp, nonce);
6666
ALTER TABLE ONLY oauthnonce
6667
ADD CONSTRAINT oauthnonce_pkey PRIMARY KEY (id);
6669
ALTER TABLE oauthnonce CLUSTER ON oauthnonce_pkey;
17158
ALTER TABLE ONLY oauthnonce
17159
ADD CONSTRAINT oauthnonce_pkey PRIMARY KEY (access_token, request_timestamp, nonce);
6671
17162
ALTER TABLE ONLY oauthrequesttoken
6672
17163
ADD CONSTRAINT oauthrequesttoken_key_key UNIQUE (key);
6674
17166
ALTER TABLE ONLY oauthrequesttoken
6675
17167
ADD CONSTRAINT oauthrequesttoken_pkey PRIMARY KEY (id);
6677
17170
ALTER TABLE ONLY officialbugtag
6678
17171
ADD CONSTRAINT officialbugtag_pkey PRIMARY KEY (id);
6680
ALTER TABLE ONLY openidassociation
6681
ADD CONSTRAINT openidassociation_pkey PRIMARY KEY (server_url, handle);
6683
17174
ALTER TABLE ONLY openidconsumerassociation
6684
17175
ADD CONSTRAINT openidconsumerassociation_pkey PRIMARY KEY (server_url, handle);
6686
17178
ALTER TABLE ONLY openidconsumernonce
6687
17179
ADD CONSTRAINT openidconsumernonce_pkey PRIMARY KEY (server_url, "timestamp", salt);
6689
ALTER TABLE ONLY openidrpconfig
6690
ADD CONSTRAINT openidrpconfig_pkey PRIMARY KEY (id);
6692
ALTER TABLE ONLY openidrpsummary
6693
ADD CONSTRAINT openidrpsummary__account__trust_root__openid_identifier__key UNIQUE (account, trust_root, openid_identifier);
6695
ALTER TABLE ONLY openidrpsummary
6696
ADD CONSTRAINT openidrpsummary_pkey PRIMARY KEY (id);
6698
ALTER TABLE ONLY packagebugsupervisor
6699
ADD CONSTRAINT packagebugsupervisor__sourcepackagename__distribution__key UNIQUE (sourcepackagename, distribution);
6701
ALTER TABLE ONLY packagebugsupervisor
6702
ADD CONSTRAINT packagebugsupervisor_pkey PRIMARY KEY (id);
17182
ALTER TABLE ONLY openididentifier
17183
ADD CONSTRAINT openididentifier_pkey PRIMARY KEY (identifier);
17186
ALTER TABLE ONLY branchmergequeue
17187
ADD CONSTRAINT owner_name UNIQUE (owner, name);
6704
17190
ALTER TABLE ONLY packagebuild
6705
17191
ADD CONSTRAINT packagebuild_pkey PRIMARY KEY (id);
17194
ALTER TABLE ONLY packagecopyjob
17195
ADD CONSTRAINT packagecopyjob__job__key UNIQUE (job);
17198
ALTER TABLE ONLY packagecopyjob
17199
ADD CONSTRAINT packagecopyjob_pkey PRIMARY KEY (id);
6707
17202
ALTER TABLE ONLY packagecopyrequest
6708
17203
ADD CONSTRAINT packagecopyrequest_pkey PRIMARY KEY (id);
6710
17206
ALTER TABLE ONLY packagediff
6711
17207
ADD CONSTRAINT packagediff_pkey PRIMARY KEY (id);
6713
17210
ALTER TABLE ONLY packagesetinclusion
6714
17211
ADD CONSTRAINT packagepayerinclusion__parent__child__key UNIQUE (parent, child);
6716
17214
ALTER TABLE ONLY binarypackagepublishinghistory
6717
17215
ADD CONSTRAINT packagepublishinghistory_pkey PRIMARY KEY (id);
6719
ALTER TABLE ONLY packageselection
6720
ADD CONSTRAINT packageselection_pkey PRIMARY KEY (id);
6722
17218
ALTER TABLE ONLY packageset
6723
17219
ADD CONSTRAINT packageset__name__distroseries__key UNIQUE (name, distroseries);
6725
17222
ALTER TABLE ONLY packageset
6726
17223
ADD CONSTRAINT packageset_pkey PRIMARY KEY (id);
6728
17226
ALTER TABLE ONLY packagesetgroup
6729
17227
ADD CONSTRAINT packagesetgroup_pkey PRIMARY KEY (id);
6731
17230
ALTER TABLE ONLY packagesetinclusion
6732
17231
ADD CONSTRAINT packagesetinclusion_pkey PRIMARY KEY (id);
6734
17234
ALTER TABLE ONLY packagesetsources
6735
17235
ADD CONSTRAINT packagesetsources__packageset__sourcepackagename__key UNIQUE (packageset, sourcepackagename);
6737
17238
ALTER TABLE ONLY packagesetsources
6738
17239
ADD CONSTRAINT packagesetsources_pkey PRIMARY KEY (id);
6740
17242
ALTER TABLE ONLY packageuploadsource
6741
17243
ADD CONSTRAINT packageuploadsource__packageupload__key UNIQUE (packageupload);
6743
17246
ALTER TABLE ONLY packaging
6744
17247
ADD CONSTRAINT packaging__distroseries__sourcepackagename__key UNIQUE (distroseries, sourcepackagename);
6746
17250
ALTER TABLE ONLY packaging
6747
17251
ADD CONSTRAINT packaging_pkey PRIMARY KEY (id);
17254
ALTER TABLE ONLY packagingjob
17255
ADD CONSTRAINT packagingjob_pkey PRIMARY KEY (id);
6749
17258
ALTER TABLE ONLY parsedapachelog
6750
17259
ADD CONSTRAINT parsedapachelog_pkey PRIMARY KEY (id);
6752
17262
ALTER TABLE ONLY person
6753
17263
ADD CONSTRAINT person__account__key UNIQUE (account);
6755
17266
ALTER TABLE ONLY person
6756
17267
ADD CONSTRAINT person__name__key UNIQUE (name);
6758
17270
ALTER TABLE ONLY person
6759
17271
ADD CONSTRAINT person_pkey PRIMARY KEY (id);
6761
17273
ALTER TABLE person CLUSTER ON person_pkey;
6763
17276
ALTER TABLE ONLY personlanguage
6764
17277
ADD CONSTRAINT personlanguage_person_key UNIQUE (person, language);
6766
17280
ALTER TABLE ONLY personlanguage
6767
17281
ADD CONSTRAINT personlanguage_pkey PRIMARY KEY (id);
6769
17284
ALTER TABLE ONLY personlocation
6770
17285
ADD CONSTRAINT personlocation_person_key UNIQUE (person);
6772
17288
ALTER TABLE ONLY personlocation
6773
17289
ADD CONSTRAINT personlocation_pkey PRIMARY KEY (id);
6775
17292
ALTER TABLE ONLY personnotification
6776
17293
ADD CONSTRAINT personnotification_pkey PRIMARY KEY (id);
17296
ALTER TABLE ONLY personsettings
17297
ADD CONSTRAINT personsettings_pkey PRIMARY KEY (person);
17300
ALTER TABLE ONLY persontransferjob
17301
ADD CONSTRAINT persontransferjob_job_key UNIQUE (job);
17304
ALTER TABLE ONLY persontransferjob
17305
ADD CONSTRAINT persontransferjob_pkey PRIMARY KEY (id);
6778
17308
ALTER TABLE ONLY pillarname
6779
17309
ADD CONSTRAINT pillarname_name_key UNIQUE (name);
6781
17312
ALTER TABLE ONLY pillarname
6782
17313
ADD CONSTRAINT pillarname_pkey PRIMARY KEY (id);
6784
17315
ALTER TABLE pillarname CLUSTER ON pillarname_pkey;
6786
17318
ALTER TABLE ONLY pocketchroot
6787
17319
ADD CONSTRAINT pocketchroot_distroarchrelease_key UNIQUE (distroarchseries, pocket);
6789
17322
ALTER TABLE ONLY pocketchroot
6790
17323
ADD CONSTRAINT pocketchroot_pkey PRIMARY KEY (id);
6792
ALTER TABLE ONLY pocomment
6793
ADD CONSTRAINT pocomment_pkey PRIMARY KEY (id);
6795
17326
ALTER TABLE ONLY poexportrequest
6796
17327
ADD CONSTRAINT poexportrequest_pkey PRIMARY KEY (id);
6798
17330
ALTER TABLE ONLY pofile
6799
17331
ADD CONSTRAINT pofile_pkey PRIMARY KEY (id);
17334
ALTER TABLE ONLY pofilestatsjob
17335
ADD CONSTRAINT pofilestatsjob_pkey PRIMARY KEY (job);
6801
17338
ALTER TABLE ONLY pofiletranslator
6802
17339
ADD CONSTRAINT pofiletranslator__person__pofile__key UNIQUE (person, pofile);
6804
17341
ALTER TABLE pofiletranslator CLUSTER ON pofiletranslator__person__pofile__key;
6806
17344
ALTER TABLE ONLY pofiletranslator
6807
17345
ADD CONSTRAINT pofiletranslator_pkey PRIMARY KEY (id);
6809
17348
ALTER TABLE ONLY poll
6810
17349
ADD CONSTRAINT poll_pkey PRIMARY KEY (id);
6812
17352
ALTER TABLE ONLY poll
6813
17353
ADD CONSTRAINT poll_team_key UNIQUE (team, name);
6815
17356
ALTER TABLE ONLY polloption
6816
17357
ADD CONSTRAINT polloption_name_key UNIQUE (name, poll);
6818
17360
ALTER TABLE ONLY polloption
6819
17361
ADD CONSTRAINT polloption_pkey PRIMARY KEY (id);
6821
17364
ALTER TABLE ONLY polloption
6822
17365
ADD CONSTRAINT polloption_poll_key UNIQUE (poll, id);
6824
17368
ALTER TABLE ONLY pomsgid
6825
17369
ADD CONSTRAINT pomsgid_pkey PRIMARY KEY (id);
6827
ALTER TABLE ONLY posubscription
6828
ADD CONSTRAINT posubscription_person_key UNIQUE (person, potemplate, language);
6830
ALTER TABLE ONLY posubscription
6831
ADD CONSTRAINT posubscription_pkey PRIMARY KEY (id);
6833
17372
ALTER TABLE ONLY potemplate
6834
17373
ADD CONSTRAINT potemplate_pkey PRIMARY KEY (id);
6836
17376
ALTER TABLE ONLY potmsgset
6837
17377
ADD CONSTRAINT potmsgset_pkey PRIMARY KEY (id);
6839
17380
ALTER TABLE ONLY potranslation
6840
17381
ADD CONSTRAINT potranslation_pkey PRIMARY KEY (id);
6842
17384
ALTER TABLE ONLY previewdiff
6843
17385
ADD CONSTRAINT previewdiff_pkey PRIMARY KEY (id);
6845
17388
ALTER TABLE ONLY processor
6846
17389
ADD CONSTRAINT processor_name_key UNIQUE (name);
6848
17392
ALTER TABLE ONLY processor
6849
17393
ADD CONSTRAINT processor_pkey PRIMARY KEY (id);
6851
17396
ALTER TABLE ONLY processorfamily
6852
17397
ADD CONSTRAINT processorfamily_name_key UNIQUE (name);
6854
17400
ALTER TABLE ONLY processorfamily
6855
17401
ADD CONSTRAINT processorfamily_pkey PRIMARY KEY (id);
6857
17404
ALTER TABLE ONLY product
6858
17405
ADD CONSTRAINT product_name_key UNIQUE (name);
17407
ALTER TABLE product CLUSTER ON product_name_key;
6860
17410
ALTER TABLE ONLY product
6861
17411
ADD CONSTRAINT product_pkey PRIMARY KEY (id);
6863
ALTER TABLE ONLY productbounty
6864
ADD CONSTRAINT productbounty_bounty_key UNIQUE (bounty, product);
6866
ALTER TABLE ONLY productbounty
6867
ADD CONSTRAINT productbounty_pkey PRIMARY KEY (id);
6869
ALTER TABLE ONLY productcvsmodule
6870
ADD CONSTRAINT productcvsmodule_pkey PRIMARY KEY (id);
6872
17414
ALTER TABLE ONLY productlicense
6873
17415
ADD CONSTRAINT productlicense__product__license__key UNIQUE (product, license);
6875
17418
ALTER TABLE ONLY productlicense
6876
17419
ADD CONSTRAINT productlicense_pkey PRIMARY KEY (id);
6878
17422
ALTER TABLE ONLY productrelease
6879
17423
ADD CONSTRAINT productrelease_milestone_key UNIQUE (milestone);
6881
17426
ALTER TABLE ONLY productrelease
6882
17427
ADD CONSTRAINT productrelease_pkey PRIMARY KEY (id);
6884
17429
ALTER TABLE productrelease CLUSTER ON productrelease_pkey;
6886
17432
ALTER TABLE ONLY productreleasefile
6887
17433
ADD CONSTRAINT productreleasefile_pkey PRIMARY KEY (id);
6889
17436
ALTER TABLE ONLY productseries
6890
17437
ADD CONSTRAINT productseries__product__name__key UNIQUE (product, name);
6892
17439
ALTER TABLE productseries CLUSTER ON productseries__product__name__key;
6894
17442
ALTER TABLE ONLY productseries
6895
17443
ADD CONSTRAINT productseries_pkey PRIMARY KEY (id);
6897
17446
ALTER TABLE ONLY productseries
6898
17447
ADD CONSTRAINT productseries_product_series_uniq UNIQUE (product, id);
6900
ALTER TABLE ONLY productseriescodeimport
6901
ADD CONSTRAINT productseriescodeimport_codeimport_key UNIQUE (codeimport);
6903
ALTER TABLE ONLY productseriescodeimport
6904
ADD CONSTRAINT productseriescodeimport_pkey PRIMARY KEY (id);
6906
ALTER TABLE ONLY productseriescodeimport
6907
ADD CONSTRAINT productseriescodeimport_productseries_key UNIQUE (productseries);
6909
ALTER TABLE ONLY productsvnmodule
6910
ADD CONSTRAINT productsvnmodule_pkey PRIMARY KEY (id);
6912
17450
ALTER TABLE ONLY project
6913
17451
ADD CONSTRAINT project_name_key UNIQUE (name);
6915
17454
ALTER TABLE ONLY project
6916
17455
ADD CONSTRAINT project_pkey PRIMARY KEY (id);
6918
17457
ALTER TABLE project CLUSTER ON project_pkey;
6920
ALTER TABLE ONLY projectbounty
6921
ADD CONSTRAINT projectbounty_bounty_key UNIQUE (bounty, project);
6923
ALTER TABLE ONLY projectbounty
6924
ADD CONSTRAINT projectbounty_pkey PRIMARY KEY (id);
6926
ALTER TABLE ONLY projectrelationship
6927
ADD CONSTRAINT projectrelationship_pkey PRIMARY KEY (id);
6929
ALTER TABLE ONLY pushmirroraccess
6930
ADD CONSTRAINT pushmirroraccess_name_key UNIQUE (name);
6932
ALTER TABLE ONLY pushmirroraccess
6933
ADD CONSTRAINT pushmirroraccess_pkey PRIMARY KEY (id);
6935
ALTER TABLE ONLY requestedcds
6936
ADD CONSTRAINT requestedcds__ds__arch__flav__request__key UNIQUE (distroseries, architecture, flavour, request);
6938
ALTER TABLE ONLY requestedcds
6939
ADD CONSTRAINT requestedcds_pkey PRIMARY KEY (id);
6941
ALTER TABLE ONLY branchrevision
6942
ADD CONSTRAINT revision__branch__revision__key UNIQUE (branch, revision);
17460
ALTER TABLE ONLY publisherconfig
17461
ADD CONSTRAINT publisherconfig_pkey PRIMARY KEY (id);
17464
ALTER TABLE ONLY questionjob
17465
ADD CONSTRAINT questionjob_job_key UNIQUE (job);
17468
ALTER TABLE ONLY questionjob
17469
ADD CONSTRAINT questionjob_pkey PRIMARY KEY (id);
6944
17472
ALTER TABLE ONLY revision
6945
17473
ADD CONSTRAINT revision__id__revision_date__key UNIQUE (id, revision_date);
6947
ALTER TABLE ONLY branchrevision
6948
ADD CONSTRAINT revision__revision__branch__key UNIQUE (revision, branch);
6950
17476
ALTER TABLE ONLY revision
6951
17477
ADD CONSTRAINT revision_revision_id_unique UNIQUE (revision_id);
6953
17480
ALTER TABLE ONLY revisioncache
6954
17481
ADD CONSTRAINT revisioncache_pkey PRIMARY KEY (id);
6956
ALTER TABLE ONLY branchrevision
6957
ADD CONSTRAINT revisionnumber_branch_id_unique UNIQUE (branch, id);
6959
17484
ALTER TABLE ONLY branchrevision
6960
17485
ADD CONSTRAINT revisionnumber_branch_sequence_unique UNIQUE (branch, sequence);
6962
17488
ALTER TABLE ONLY branchrevision
6963
ADD CONSTRAINT revisionnumber_pkey PRIMARY KEY (id);
17489
ADD CONSTRAINT revisionnumber_pkey PRIMARY KEY (revision, branch);
6965
17492
ALTER TABLE ONLY revisionparent
6966
17493
ADD CONSTRAINT revisionparent_pkey PRIMARY KEY (id);
6968
17496
ALTER TABLE ONLY revisionparent
6969
17497
ADD CONSTRAINT revisionparent_unique UNIQUE (revision, parent_id);
6971
17500
ALTER TABLE ONLY revisionproperty
6972
17501
ADD CONSTRAINT revisionproperty__revision__name__key UNIQUE (revision, name);
6974
17504
ALTER TABLE ONLY revisionproperty
6975
17505
ADD CONSTRAINT revisionproperty_pkey PRIMARY KEY (id);
6977
17508
ALTER TABLE ONLY scriptactivity
6978
17509
ADD CONSTRAINT scriptactivity_pkey PRIMARY KEY (id);
6980
17512
ALTER TABLE ONLY section
6981
17513
ADD CONSTRAINT section_name_key UNIQUE (name);
6983
17516
ALTER TABLE ONLY section
6984
17517
ADD CONSTRAINT section_pkey PRIMARY KEY (id);
6986
17520
ALTER TABLE ONLY sectionselection
6987
17521
ADD CONSTRAINT sectionselection_pkey PRIMARY KEY (id);
6989
17524
ALTER TABLE ONLY seriessourcepackagebranch
6990
17525
ADD CONSTRAINT seriessourcepackagebranch__ds__spn__pocket__key UNIQUE (distroseries, sourcepackagename, pocket);
6992
17528
ALTER TABLE ONLY seriessourcepackagebranch
6993
17529
ADD CONSTRAINT seriessourcepackagebranch_pkey PRIMARY KEY (id);
6995
ALTER TABLE ONLY shipitreport
6996
ADD CONSTRAINT shipitreport_pkey PRIMARY KEY (id);
6998
ALTER TABLE ONLY shipitsurvey
6999
ADD CONSTRAINT shipitsurvey_pkey PRIMARY KEY (id);
7001
ALTER TABLE ONLY shipitsurveyanswer
7002
ADD CONSTRAINT shipitsurveyanswer_answer_key UNIQUE (answer);
7004
ALTER TABLE ONLY shipitsurveyanswer
7005
ADD CONSTRAINT shipitsurveyanswer_pkey PRIMARY KEY (id);
7007
ALTER TABLE ONLY shipitsurveyquestion
7008
ADD CONSTRAINT shipitsurveyquestion_pkey PRIMARY KEY (id);
7010
ALTER TABLE ONLY shipitsurveyquestion
7011
ADD CONSTRAINT shipitsurveyquestion_question_key UNIQUE (question);
7013
ALTER TABLE ONLY shipitsurveyresult
7014
ADD CONSTRAINT shipitsurveyresult_pkey PRIMARY KEY (id);
7016
ALTER TABLE ONLY shipment
7017
ADD CONSTRAINT shipment_logintoken_key UNIQUE (logintoken);
7019
ALTER TABLE ONLY shipment
7020
ADD CONSTRAINT shipment_pkey PRIMARY KEY (id);
7022
ALTER TABLE ONLY shippingrequest
7023
ADD CONSTRAINT shippingrequest_pkey PRIMARY KEY (id);
7025
ALTER TABLE ONLY shippingrequest
7026
ADD CONSTRAINT shippingrequest_shipment_key UNIQUE (shipment);
7028
ALTER TABLE ONLY shippingrun
7029
ADD CONSTRAINT shippingrun_csvfile_uniq UNIQUE (csvfile);
7031
ALTER TABLE ONLY shippingrun
7032
ADD CONSTRAINT shippingrun_pkey PRIMARY KEY (id);
7034
17532
ALTER TABLE ONLY signedcodeofconduct
7035
17533
ADD CONSTRAINT signedcodeofconduct_pkey PRIMARY KEY (id);
7037
ALTER TABLE ONLY mentoringoffer
7038
ADD CONSTRAINT single_offer_per_bug_key UNIQUE (bug, owner);
7040
ALTER TABLE ONLY mentoringoffer
7041
ADD CONSTRAINT single_offer_per_spec_key UNIQUE (specification, owner);
7043
17536
ALTER TABLE ONLY sourcepackageformatselection
7044
17537
ADD CONSTRAINT sourceformatselection__distroseries__format__key UNIQUE (distroseries, format);
7046
17540
ALTER TABLE ONLY sourcepackageformatselection
7047
17541
ADD CONSTRAINT sourcepackageformatselection_pkey PRIMARY KEY (id);
7049
17544
ALTER TABLE ONLY sourcepackagename
7050
17545
ADD CONSTRAINT sourcepackagename_name_key UNIQUE (name);
7052
17548
ALTER TABLE ONLY sourcepackagename
7053
17549
ADD CONSTRAINT sourcepackagename_pkey PRIMARY KEY (id);
7055
17552
ALTER TABLE ONLY sourcepackagepublishinghistory
7056
17553
ADD CONSTRAINT sourcepackagepublishinghistory_pkey PRIMARY KEY (id);
7058
17556
ALTER TABLE ONLY sourcepackagerecipe
7059
17557
ADD CONSTRAINT sourcepackagerecipe__owner__name__key UNIQUE (owner, name);
7061
17560
ALTER TABLE ONLY sourcepackagerecipedistroseries
7062
17561
ADD CONSTRAINT sourcepackagerecipe_distroseries_unique UNIQUE (sourcepackagerecipe, distroseries);
7064
17564
ALTER TABLE ONLY sourcepackagerecipe
7065
17565
ADD CONSTRAINT sourcepackagerecipe_pkey PRIMARY KEY (id);
7067
17568
ALTER TABLE ONLY sourcepackagerecipebuild
7068
17569
ADD CONSTRAINT sourcepackagerecipebuild_pkey PRIMARY KEY (id);
7070
17572
ALTER TABLE ONLY sourcepackagerecipebuildjob
7071
17573
ADD CONSTRAINT sourcepackagerecipebuildjob__job__key UNIQUE (job);
7073
17576
ALTER TABLE ONLY sourcepackagerecipebuildjob
7074
17577
ADD CONSTRAINT sourcepackagerecipebuildjob__sourcepackage_recipe_build__key UNIQUE (sourcepackage_recipe_build);
7076
17580
ALTER TABLE ONLY sourcepackagerecipebuildjob
7077
17581
ADD CONSTRAINT sourcepackagerecipebuildjob_pkey PRIMARY KEY (id);
7079
17584
ALTER TABLE ONLY sourcepackagerecipedata
7080
17585
ADD CONSTRAINT sourcepackagerecipedata_pkey PRIMARY KEY (id);
7082
17588
ALTER TABLE ONLY sourcepackagerecipedatainstruction
7083
17589
ADD CONSTRAINT sourcepackagerecipedatainstruction__name__recipe_data__key UNIQUE (name, recipe_data);
7085
17592
ALTER TABLE ONLY sourcepackagerecipedatainstruction
7086
17593
ADD CONSTRAINT sourcepackagerecipedatainstruction__recipe_data__line_number__k UNIQUE (recipe_data, line_number);
7088
17596
ALTER TABLE ONLY sourcepackagerecipedatainstruction
7089
17597
ADD CONSTRAINT sourcepackagerecipedatainstruction_pkey PRIMARY KEY (id);
7091
17600
ALTER TABLE ONLY sourcepackagerecipedistroseries
7092
17601
ADD CONSTRAINT sourcepackagerecipedistroseries_pkey PRIMARY KEY (id);
7094
17604
ALTER TABLE ONLY sourcepackagerelease
7095
17605
ADD CONSTRAINT sourcepackagerelease_pkey PRIMARY KEY (id);
7097
17608
ALTER TABLE ONLY sourcepackagereleasefile
7098
17609
ADD CONSTRAINT sourcepackagereleasefile_pkey PRIMARY KEY (id);
7100
17612
ALTER TABLE ONLY specificationbug
7101
17613
ADD CONSTRAINT specification_bug_uniq UNIQUE (specification, bug);
7103
17616
ALTER TABLE ONLY specification
7104
17617
ADD CONSTRAINT specification_distribution_name_uniq UNIQUE (distribution, name);
7106
17620
ALTER TABLE ONLY specification
7107
17621
ADD CONSTRAINT specification_pkey PRIMARY KEY (id);
7109
17624
ALTER TABLE ONLY specification
7110
17625
ADD CONSTRAINT specification_product_name_uniq UNIQUE (name, product);
7112
17628
ALTER TABLE ONLY specification
7113
17629
ADD CONSTRAINT specification_specurl_uniq UNIQUE (specurl);
7115
17632
ALTER TABLE ONLY specificationbranch
7116
17633
ADD CONSTRAINT specificationbranch__spec_branch_unique UNIQUE (branch, specification);
7118
17636
ALTER TABLE ONLY specificationbranch
7119
17637
ADD CONSTRAINT specificationbranch_pkey PRIMARY KEY (id);
7121
17640
ALTER TABLE ONLY specificationbug
7122
17641
ADD CONSTRAINT specificationbug_pkey PRIMARY KEY (id);
7124
17644
ALTER TABLE ONLY specificationdependency
7125
17645
ADD CONSTRAINT specificationdependency_pkey PRIMARY KEY (id);
7127
17648
ALTER TABLE ONLY specificationdependency
7128
17649
ADD CONSTRAINT specificationdependency_uniq UNIQUE (specification, dependency);
7130
17652
ALTER TABLE ONLY specificationfeedback
7131
17653
ADD CONSTRAINT specificationfeedback_pkey PRIMARY KEY (id);
7133
17656
ALTER TABLE ONLY specificationmessage
7134
17657
ADD CONSTRAINT specificationmessage__specification__message__key UNIQUE (specification, message);
7136
17660
ALTER TABLE ONLY specificationmessage
7137
17661
ADD CONSTRAINT specificationmessage_pkey PRIMARY KEY (id);
7139
17664
ALTER TABLE ONLY specificationsubscription
7140
17665
ADD CONSTRAINT specificationsubscription_pkey PRIMARY KEY (id);
7142
17668
ALTER TABLE ONLY specificationsubscription
7143
17669
ADD CONSTRAINT specificationsubscription_spec_person_uniq UNIQUE (specification, person);
7145
17672
ALTER TABLE ONLY spokenin
7146
17673
ADD CONSTRAINT spokenin__country__language__key UNIQUE (language, country);
7148
17676
ALTER TABLE ONLY spokenin
7149
17677
ADD CONSTRAINT spokenin_pkey PRIMARY KEY (id);
7151
17680
ALTER TABLE ONLY sprint
7152
17681
ADD CONSTRAINT sprint_name_uniq UNIQUE (name);
7154
17684
ALTER TABLE ONLY sprint
7155
17685
ADD CONSTRAINT sprint_pkey PRIMARY KEY (id);
7157
17688
ALTER TABLE ONLY sprintattendance
7158
17689
ADD CONSTRAINT sprintattendance_attendance_uniq UNIQUE (attendee, sprint);
7160
17692
ALTER TABLE ONLY sprintattendance
7161
17693
ADD CONSTRAINT sprintattendance_pkey PRIMARY KEY (id);
7163
17696
ALTER TABLE ONLY sprintspecification
7164
17697
ADD CONSTRAINT sprintspec_uniq UNIQUE (specification, sprint);
7166
17700
ALTER TABLE ONLY sprintspecification
7167
17701
ADD CONSTRAINT sprintspecification_pkey PRIMARY KEY (id);
7169
17704
ALTER TABLE ONLY sshkey
7170
17705
ADD CONSTRAINT sshkey_pkey PRIMARY KEY (id);
7172
ALTER TABLE ONLY standardshipitrequest
7173
ADD CONSTRAINT standardshipitrequest_flavour_quantity_key UNIQUE (flavour, quantityx86, quantityppc, quantityamd64);
7175
ALTER TABLE ONLY standardshipitrequest
7176
ADD CONSTRAINT standardshipitrequest_pkey PRIMARY KEY (id);
7178
ALTER TABLE ONLY staticdiff
7179
ADD CONSTRAINT staticdiff_from_revision_id_key UNIQUE (from_revision_id, to_revision_id);
7181
ALTER TABLE ONLY staticdiff
7182
ADD CONSTRAINT staticdiff_pkey PRIMARY KEY (id);
7184
17708
ALTER TABLE ONLY structuralsubscription
7185
17709
ADD CONSTRAINT structuralsubscription_pkey PRIMARY KEY (id);
17712
ALTER TABLE ONLY subunitstream
17713
ADD CONSTRAINT subunitstream_pkey PRIMARY KEY (id);
7187
17716
ALTER TABLE ONLY suggestivepotemplate
7188
17717
ADD CONSTRAINT suggestivepotemplate_pkey PRIMARY KEY (potemplate);
7190
17720
ALTER TABLE ONLY answercontact
7191
17721
ADD CONSTRAINT supportcontact__distribution__sourcepackagename__person__key UNIQUE (distribution, sourcepackagename, person);
7193
17724
ALTER TABLE ONLY answercontact
7194
17725
ADD CONSTRAINT supportcontact__product__person__key UNIQUE (product, person);
7196
17728
ALTER TABLE ONLY answercontact
7197
17729
ADD CONSTRAINT supportcontact_pkey PRIMARY KEY (id);
7199
17732
ALTER TABLE ONLY teamparticipation
7200
17733
ADD CONSTRAINT teamparticipation_pkey PRIMARY KEY (id);
7202
17736
ALTER TABLE ONLY teamparticipation
7203
17737
ADD CONSTRAINT teamparticipation_team_key UNIQUE (team, person);
7205
17740
ALTER TABLE ONLY temporaryblobstorage
7206
17741
ADD CONSTRAINT temporaryblobstorage_file_alias_key UNIQUE (file_alias);
7208
17744
ALTER TABLE ONLY temporaryblobstorage
7209
17745
ADD CONSTRAINT temporaryblobstorage_pkey PRIMARY KEY (id);
7211
17747
ALTER TABLE temporaryblobstorage CLUSTER ON temporaryblobstorage_pkey;
7213
17750
ALTER TABLE ONLY temporaryblobstorage
7214
17751
ADD CONSTRAINT temporaryblobstorage_uuid_key UNIQUE (uuid);
7216
17754
ALTER TABLE ONLY question
7217
17755
ADD CONSTRAINT ticket_pkey PRIMARY KEY (id);
7219
17758
ALTER TABLE ONLY questionbug
7220
17759
ADD CONSTRAINT ticketbug_bug_ticket_uniq UNIQUE (bug, question);
7222
17762
ALTER TABLE ONLY questionbug
7223
17763
ADD CONSTRAINT ticketbug_pkey PRIMARY KEY (id);
7225
17766
ALTER TABLE ONLY questionmessage
7226
17767
ADD CONSTRAINT ticketmessage_message_ticket_uniq UNIQUE (message, question);
7228
17770
ALTER TABLE ONLY questionmessage
7229
17771
ADD CONSTRAINT ticketmessage_pkey PRIMARY KEY (id);
7231
17774
ALTER TABLE ONLY questionreopening
7232
17775
ADD CONSTRAINT ticketreopening_pkey PRIMARY KEY (id);
7234
17778
ALTER TABLE ONLY questionsubscription
7235
17779
ADD CONSTRAINT ticketsubscription_pkey PRIMARY KEY (id);
7237
17782
ALTER TABLE ONLY questionsubscription
7238
17783
ADD CONSTRAINT ticketsubscription_ticket_person_uniq UNIQUE (question, person);
7240
17786
ALTER TABLE ONLY translator
7241
17787
ADD CONSTRAINT translation_translationgroup_key UNIQUE (translationgroup, language);
7243
17790
ALTER TABLE ONLY translationgroup
7244
17791
ADD CONSTRAINT translationgroup_name_key UNIQUE (name);
7246
17794
ALTER TABLE ONLY translationgroup
7247
17795
ADD CONSTRAINT translationgroup_pkey PRIMARY KEY (id);
7249
17798
ALTER TABLE ONLY translationimportqueueentry
7250
17799
ADD CONSTRAINT translationimportqueueentry_pkey PRIMARY KEY (id);
7252
17802
ALTER TABLE ONLY translationmessage
7253
17803
ADD CONSTRAINT translationmessage_pkey PRIMARY KEY (id);
7255
17806
ALTER TABLE ONLY translationrelicensingagreement
7256
17807
ADD CONSTRAINT translationrelicensingagreement__person__key UNIQUE (person);
7258
17810
ALTER TABLE ONLY translationrelicensingagreement
7259
17811
ADD CONSTRAINT translationrelicensingagreement_pkey PRIMARY KEY (id);
7261
17814
ALTER TABLE ONLY translationtemplateitem
7262
17815
ADD CONSTRAINT translationtemplateitem_pkey PRIMARY KEY (id);
17818
ALTER TABLE ONLY translationtemplatesbuild
17819
ADD CONSTRAINT translationtemplatesbuild_pkey PRIMARY KEY (id);
7264
17822
ALTER TABLE ONLY translator
7265
17823
ADD CONSTRAINT translator_pkey PRIMARY KEY (id);
7267
17826
ALTER TABLE ONLY specificationfeedback
7268
17827
ADD CONSTRAINT unique_spec_requestor_provider UNIQUE (specification, requester, reviewer);
7270
17830
ALTER TABLE ONLY usertouseremail
7271
17831
ADD CONSTRAINT usertouseremail_pkey PRIMARY KEY (id);
7273
17834
ALTER TABLE ONLY vote
7274
17835
ADD CONSTRAINT vote_pkey PRIMARY KEY (id);
7276
17838
ALTER TABLE ONLY votecast
7277
17839
ADD CONSTRAINT votecast_person_key UNIQUE (person, poll);
7279
17842
ALTER TABLE ONLY votecast
7280
17843
ADD CONSTRAINT votecast_pkey PRIMARY KEY (id);
7282
ALTER TABLE ONLY webserviceban
7283
ADD CONSTRAINT webserviceban_pkey PRIMARY KEY (id);
7285
17846
ALTER TABLE ONLY wikiname
7286
17847
ADD CONSTRAINT wikiname_pkey PRIMARY KEY (id);
7288
17850
ALTER TABLE ONLY wikiname
7289
17851
ADD CONSTRAINT wikiname_wikiname_key UNIQUE (wikiname, wiki);
7291
CREATE INDEX account__old_openid_identifier__idx ON account USING btree (old_openid_identifier);
17854
CREATE UNIQUE INDEX accessartifactgrant__artifact__grantee__key ON accesspolicygrant USING btree (artifact, grantee) WHERE (artifact IS NOT NULL);
17857
CREATE UNIQUE INDEX accesspolicy__distribution__type__key ON accesspolicy USING btree (distribution, type) WHERE (distribution IS NOT NULL);
17860
CREATE UNIQUE INDEX accesspolicy__product__type__key ON accesspolicy USING btree (product, type) WHERE (product IS NOT NULL);
17863
CREATE UNIQUE INDEX accesspolicyartifact__branch__key ON accesspolicyartifact USING btree (branch) WHERE (branch IS NOT NULL);
17866
CREATE UNIQUE INDEX accesspolicyartifact__bug__key ON accesspolicyartifact USING btree (bug) WHERE (bug IS NOT NULL);
17869
CREATE INDEX accesspolicyartifact__policy__key ON accesspolicyartifact USING btree (policy);
17872
CREATE INDEX accesspolicygrant__grantee__idx ON accesspolicygrant USING btree (grantee);
17875
CREATE INDEX accesspolicygrant__grantor__idx ON accesspolicygrant USING btree (grantor);
17878
CREATE UNIQUE INDEX accesspolicygrant__policy__grantee__key ON accesspolicygrant USING btree (policy, grantee) WHERE (policy IS NOT NULL);
7293
17881
CREATE INDEX announcement__distribution__active__idx ON announcement USING btree (distribution, active) WHERE (distribution IS NOT NULL);
7295
17884
CREATE INDEX announcement__product__active__idx ON announcement USING btree (product, active) WHERE (product IS NOT NULL);
7297
17887
CREATE INDEX announcement__project__active__idx ON announcement USING btree (project, active) WHERE (project IS NOT NULL);
7299
17890
CREATE INDEX announcement__registrant__idx ON announcement USING btree (registrant);
7301
17893
CREATE UNIQUE INDEX answercontact__distribution__person__key ON answercontact USING btree (distribution, person) WHERE (sourcepackagename IS NULL);
7303
17896
CREATE INDEX answercontact__person__idx ON answercontact USING btree (person);
7305
17899
CREATE INDEX apportjob__blob__idx ON apportjob USING btree (blob);
7307
CREATE INDEX archive__commercial__idx ON archive USING btree (commercial);
7309
17902
CREATE UNIQUE INDEX archive__distribution__purpose__key ON archive USING btree (distribution, purpose) WHERE (purpose = ANY (ARRAY[1, 4]));
7311
17905
CREATE INDEX archive__owner__idx ON archive USING btree (owner);
7313
17908
CREATE UNIQUE INDEX archive__owner__key ON archive USING btree (owner, distribution, name);
7315
17911
CREATE INDEX archive__require_virtualized__idx ON archive USING btree (require_virtualized);
7317
17914
CREATE INDEX archive__signing_key__idx ON archive USING btree (signing_key) WHERE (signing_key IS NOT NULL);
7319
17917
CREATE INDEX archive__status__idx ON archive USING btree (status);
7321
CREATE INDEX archive_fti ON archive USING gist (fti ts2.gist_tsvector_ops);
17920
CREATE INDEX archive_fti ON archive USING gist (fti);
7323
17923
CREATE INDEX archiveauthtoken__archive__idx ON archiveauthtoken USING btree (archive);
7325
17926
CREATE INDEX archiveauthtoken__date_created__idx ON archiveauthtoken USING btree (date_created);
7327
17929
CREATE INDEX archiveauthtoken__person__idx ON archiveauthtoken USING btree (person);
7329
17932
CREATE INDEX archivedependency__archive__idx ON archivedependency USING btree (archive);
7331
17935
CREATE INDEX archivedependency__component__idx ON archivedependency USING btree (component);
7333
17938
CREATE INDEX archivedependency__dependency__idx ON archivedependency USING btree (dependency);
7335
17941
CREATE INDEX archivejob__archive__job_type__idx ON archivejob USING btree (archive, job_type);
7337
17944
CREATE INDEX archivepermission__archive__component__permission__idx ON archivepermission USING btree (archive, component, permission);
7339
17947
CREATE INDEX archivepermission__archive__sourcepackagename__permission__idx ON archivepermission USING btree (archive, sourcepackagename, permission);
7341
17950
CREATE INDEX archivepermission__packageset__idx ON archivepermission USING btree (packageset) WHERE (packageset IS NOT NULL);
7343
17953
CREATE INDEX archivepermission__person__archive__idx ON archivepermission USING btree (person, archive);
7345
17956
CREATE INDEX archivesubscriber__archive__idx ON archivesubscriber USING btree (archive);
7347
17959
CREATE INDEX archivesubscriber__cancelled_by__idx ON archivesubscriber USING btree (cancelled_by) WHERE (cancelled_by IS NOT NULL);
7349
17962
CREATE INDEX archivesubscriber__date_created__idx ON archivesubscriber USING btree (date_created);
7351
17965
CREATE INDEX archivesubscriber__date_expires__idx ON archivesubscriber USING btree (date_expires) WHERE (date_expires IS NOT NULL);
7353
17968
CREATE INDEX archivesubscriber__registrant__idx ON archivesubscriber USING btree (registrant);
7355
17971
CREATE INDEX archivesubscriber__subscriber__idx ON archivesubscriber USING btree (subscriber);
7357
CREATE INDEX authtoken__date_consumed__idx ON authtoken USING btree (date_consumed);
7359
CREATE INDEX authtoken__date_created__idx ON authtoken USING btree (date_created);
7361
CREATE INDEX authtoken__requester__idx ON authtoken USING btree (requester);
7363
17974
CREATE INDEX binarypackagebuild__distro_arch_series__idx ON binarypackagebuild USING btree (distro_arch_series);
7365
17977
CREATE UNIQUE INDEX binarypackagebuild__package_build__idx ON binarypackagebuild USING btree (package_build);
7367
17980
CREATE INDEX binarypackagebuild__source_package_release_idx ON binarypackagebuild USING btree (source_package_release);
7369
17983
CREATE INDEX binarypackagefile_binarypackage_idx ON binarypackagefile USING btree (binarypackagerelease);
7371
17986
CREATE INDEX binarypackagefile_libraryfile_idx ON binarypackagefile USING btree (libraryfile);
17989
CREATE INDEX binarypackagepublishinghistory__binarypackagename__idx ON binarypackagepublishinghistory USING btree (binarypackagename);
7373
17992
CREATE UNIQUE INDEX binarypackagerelease__debug_package__key ON binarypackagerelease USING btree (debug_package);
17995
CREATE INDEX binarypackagerelease__version__idx ON binarypackagerelease USING btree (version);
7375
17998
CREATE INDEX binarypackagerelease_build_idx ON binarypackagerelease USING btree (build);
7377
CREATE INDEX binarypackagerelease_fti ON binarypackagerelease USING gist (fti ts2.gist_tsvector_ops);
7379
CREATE INDEX binarypackagerelease_version_idx ON binarypackagerelease USING btree (version);
7381
CREATE INDEX binarypackagerelease_version_sort ON binarypackagerelease USING btree (debversion_sort_key(version));
7383
CREATE INDEX bounty__claimant__idx ON bounty USING btree (claimant);
7385
CREATE INDEX bounty__owner__idx ON bounty USING btree (owner);
7387
CREATE INDEX bounty__reviewer__idx ON bounty USING btree (reviewer);
7389
CREATE INDEX bounty_usdvalue_idx ON bounty USING btree (usdvalue);
7391
CREATE INDEX bountymessage_bounty_idx ON bountymessage USING btree (bounty);
18001
CREATE INDEX binarypackagerelease_fti ON binarypackagerelease USING gist (fti);
18004
CREATE INDEX branch__access_policy__idx ON branch USING btree (access_policy);
7393
18007
CREATE INDEX branch__date_created__idx ON branch USING btree (date_created);
7395
18010
CREATE UNIQUE INDEX branch__ds__spn__owner__name__key ON branch USING btree (distroseries, sourcepackagename, owner, name) WHERE (distroseries IS NOT NULL);
7397
18013
CREATE INDEX branch__last_scanned__owner__idx ON branch USING btree (last_scanned, owner) WHERE (last_scanned IS NOT NULL);
18016
CREATE INDEX branch__merge_queue__idx ON branch USING btree (merge_queue);
7399
18019
CREATE INDEX branch__next_mirror_time__idx ON branch USING btree (next_mirror_time) WHERE (next_mirror_time IS NOT NULL);
7401
18022
CREATE UNIQUE INDEX branch__owner__name__key ON branch USING btree (owner, name) WHERE ((product IS NULL) AND (distroseries IS NULL));
7403
18025
CREATE INDEX branch__owner_name__idx ON branch USING btree (owner_name);
7405
18028
CREATE INDEX branch__private__idx ON branch USING btree (private);
7407
18031
CREATE INDEX branch__product__id__idx ON branch USING btree (product, id);
7409
18033
ALTER TABLE branch CLUSTER ON branch__product__id__idx;
7411
18036
CREATE UNIQUE INDEX branch__product__owner__name__key ON branch USING btree (product, owner, name) WHERE (product IS NOT NULL);
7413
18039
CREATE INDEX branch__registrant__idx ON branch USING btree (registrant);
7415
18042
CREATE INDEX branch__reviewer__idx ON branch USING btree (reviewer);
7417
18045
CREATE INDEX branch__stacked_on__idx ON branch USING btree (stacked_on) WHERE (stacked_on IS NOT NULL);
7419
18048
CREATE INDEX branch__target_suffix__idx ON branch USING btree (target_suffix);
18051
CREATE INDEX branch__transitively_private__idx ON branch USING btree (transitively_private);
7421
18054
CREATE INDEX branch_author_idx ON branch USING btree (author);
7423
18057
CREATE INDEX branch_owner_idx ON branch USING btree (owner);
7425
18060
CREATE INDEX branchjob__branch__idx ON branchjob USING btree (branch);
7427
18063
CREATE INDEX branchmergeproposal__dependent_branch__idx ON branchmergeproposal USING btree (dependent_branch);
7429
18066
CREATE INDEX branchmergeproposal__merge_diff__idx ON branchmergeproposal USING btree (merge_diff);
7431
18069
CREATE INDEX branchmergeproposal__merge_log_file__idx ON branchmergeproposal USING btree (merge_log_file);
7433
18072
CREATE INDEX branchmergeproposal__merge_reporter__idx ON branchmergeproposal USING btree (merge_reporter) WHERE (merge_reporter IS NOT NULL);
7435
18075
CREATE INDEX branchmergeproposal__merger__idx ON branchmergeproposal USING btree (merger);
7437
18078
CREATE INDEX branchmergeproposal__queuer__idx ON branchmergeproposal USING btree (queuer);
7439
18081
CREATE INDEX branchmergeproposal__registrant__idx ON branchmergeproposal USING btree (registrant);
7441
CREATE INDEX branchmergeproposal__review_diff__idx ON branchmergeproposal USING btree (review_diff);
7443
18084
CREATE INDEX branchmergeproposal__reviewer__idx ON branchmergeproposal USING btree (reviewer);
7445
18087
CREATE INDEX branchmergeproposal__source_branch__idx ON branchmergeproposal USING btree (source_branch);
7447
18090
CREATE INDEX branchmergeproposal__superseded_by__idx ON branchmergeproposal USING btree (superseded_by) WHERE (superseded_by IS NOT NULL);
7449
18093
CREATE INDEX branchmergeproposal__target_branch__idx ON branchmergeproposal USING btree (target_branch);
7451
18096
CREATE INDEX branchmergeproposaljob__branch_merge_proposal__idx ON branchmergeproposaljob USING btree (branch_merge_proposal);
7453
CREATE INDEX branchmergerobot__owner__idx ON branchmergerobot USING btree (owner);
7455
CREATE INDEX branchmergerobot__registrant__idx ON branchmergerobot USING btree (registrant);
18099
CREATE INDEX branchmergequeue__registrant__idx ON branchmergequeue USING btree (registrant);
7457
18102
CREATE INDEX branchsubscription__branch__idx ON branchsubscription USING btree (branch);
7459
18105
CREATE INDEX branchsubscription__subscribed_by__idx ON branchsubscription USING btree (subscribed_by);
7461
18108
CREATE INDEX branchvisibilitypolicy__product__idx ON branchvisibilitypolicy USING btree (product) WHERE (product IS NOT NULL);
7463
18111
CREATE INDEX branchvisibilitypolicy__project__idx ON branchvisibilitypolicy USING btree (project) WHERE (project IS NOT NULL);
7465
18114
CREATE INDEX branchvisibilitypolicy__team__idx ON branchvisibilitypolicy USING btree (team) WHERE (team IS NOT NULL);
7467
18117
CREATE UNIQUE INDEX branchvisibilitypolicy__unq ON branchvisibilitypolicy USING btree ((COALESCE(product, (-1))), (COALESCE(project, (-1))), (COALESCE(team, (-1))));
18120
CREATE INDEX bug__access_policy__idx ON bug USING btree (access_policy);
7469
18123
CREATE INDEX bug__date_last_message__idx ON bug USING btree (date_last_message);
7471
18126
CREATE INDEX bug__date_last_updated__idx ON bug USING btree (date_last_updated);
7473
18128
ALTER TABLE bug CLUSTER ON bug__date_last_updated__idx;
7475
18131
CREATE INDEX bug__datecreated__idx ON bug USING btree (datecreated);
7477
18134
CREATE INDEX bug__heat__idx ON bug USING btree (heat);
7479
18137
CREATE INDEX bug__heat_last_updated__idx ON bug USING btree (heat_last_updated);
7481
18140
CREATE INDEX bug__latest_patch_uploaded__idx ON bug USING btree (latest_patch_uploaded);
18143
CREATE UNIQUE INDEX bug__name__key ON bug USING btree (name) WHERE (name IS NOT NULL);
18146
CREATE INDEX bug__new_patches__idx ON bug USING btree (id) WHERE ((latest_patch_uploaded IS NOT NULL) AND (duplicateof IS NULL));
7483
18149
CREATE INDEX bug__users_affected_count__idx ON bug USING btree (users_affected_count);
7485
18152
CREATE INDEX bug__users_unaffected_count__idx ON bug USING btree (users_unaffected_count);
7487
18155
CREATE INDEX bug__who_made_private__idx ON bug USING btree (who_made_private) WHERE (who_made_private IS NOT NULL);
7489
18158
CREATE INDEX bug_duplicateof_idx ON bug USING btree (duplicateof);
7491
18161
CREATE INDEX bug_fti ON bug USING gist (fti);
7493
18164
CREATE INDEX bug_owner_idx ON bug USING btree (owner);
7495
18167
CREATE INDEX bugactivity_bug_datechanged_idx ON bugactivity USING btree (bug, datechanged);
7497
18170
CREATE INDEX bugactivity_datechanged_idx ON bugactivity USING btree (datechanged);
7499
18173
CREATE INDEX bugactivity_person_datechanged_idx ON bugactivity USING btree (person, datechanged);
7501
18176
CREATE INDEX bugaffectsperson__person__idx ON bugaffectsperson USING btree (person);
7503
18179
CREATE INDEX bugattachment__bug__idx ON bugattachment USING btree (bug);
7505
18182
CREATE INDEX bugattachment_libraryfile_idx ON bugattachment USING btree (libraryfile);
7507
18185
CREATE INDEX bugattachment_message_idx ON bugattachment USING btree (message);
7509
18188
CREATE INDEX bugbranch__registrant__idx ON bugbranch USING btree (registrant);
7511
18191
CREATE INDEX bugcve_cve_index ON bugcve USING btree (cve);
7513
18194
CREATE INDEX bugjob__bug__job_type__idx ON bugjob USING btree (bug, job_type);
18197
CREATE INDEX bugmessage__owner__index__idx ON bugmessage USING btree (owner, index);
7515
18200
CREATE INDEX bugmessage_message_idx ON bugmessage USING btree (message);
18203
CREATE INDEX bugmute__bug__idx ON bugmute USING btree (bug);
7517
18206
CREATE INDEX bugnomination__bug__idx ON bugnomination USING btree (bug);
7519
18209
CREATE INDEX bugnomination__decider__idx ON bugnomination USING btree (decider) WHERE (decider IS NOT NULL);
7521
18212
CREATE UNIQUE INDEX bugnomination__distroseries__bug__key ON bugnomination USING btree (distroseries, bug) WHERE (distroseries IS NOT NULL);
7523
18215
CREATE INDEX bugnomination__owner__idx ON bugnomination USING btree (owner);
7525
18218
CREATE UNIQUE INDEX bugnomination__productseries__bug__key ON bugnomination USING btree (productseries, bug) WHERE (productseries IS NOT NULL);
7527
18221
CREATE INDEX bugnotification__date_emailed__idx ON bugnotification USING btree (date_emailed);
18223
ALTER TABLE bugnotification CLUSTER ON bugnotification__date_emailed__idx;
7529
18226
CREATE INDEX bugnotificationattachment__bug_notification__idx ON bugnotificationattachment USING btree (bug_notification);
7531
18229
CREATE INDEX bugnotificationattachment__message__idx ON bugnotificationattachment USING btree (message);
18232
CREATE INDEX bugnotificationfilter__bug_subscription_filter__idx ON bugnotificationfilter USING btree (bug_subscription_filter);
7533
18235
CREATE INDEX bugnotificationrecipient__person__idx ON bugnotificationrecipient USING btree (person);
7535
18238
CREATE INDEX bugnotificationrecipientarchive__bug_notification__idx ON bugnotificationrecipientarchive USING btree (bug_notification);
7537
18241
CREATE INDEX bugnotificationrecipientarchive__person__idx ON bugnotificationrecipientarchive USING btree (person);
7539
CREATE INDEX bugpackageinfestation__creator__idx ON bugpackageinfestation USING btree (creator);
7541
CREATE INDEX bugpackageinfestation__lastmodifiedby__idx ON bugpackageinfestation USING btree (lastmodifiedby);
7543
CREATE INDEX bugpackageinfestation__verifiedby__idx ON bugpackageinfestation USING btree (verifiedby);
7545
CREATE INDEX bugproductinfestation__creator__idx ON bugproductinfestation USING btree (creator);
7547
CREATE INDEX bugproductinfestation__lastmodifiedby__idx ON bugproductinfestation USING btree (lastmodifiedby);
7549
CREATE INDEX bugproductinfestation__verifiedby__idx ON bugproductinfestation USING btree (verifiedby);
7551
18244
CREATE INDEX bugsubscription__subscribed_by__idx ON bugsubscription USING btree (subscribed_by);
7553
18247
CREATE INDEX bugsubscription_bug_idx ON bugsubscription USING btree (bug);
7555
18249
ALTER TABLE bugsubscription CLUSTER ON bugsubscription_bug_idx;
7557
18252
CREATE INDEX bugsubscription_person_idx ON bugsubscription USING btree (person);
18255
CREATE INDEX bugsubscriptionfilter__bug_notification_level__idx ON bugsubscriptionfilter USING btree (bug_notification_level);
18258
CREATE INDEX bugsubscriptionfilter__structuralsubscription ON bugsubscriptionfilter USING btree (structuralsubscription);
18261
CREATE INDEX bugsubscriptionfilterimportance__filter__importance__idx ON bugsubscriptionfilterimportance USING btree (filter, importance);
18264
CREATE INDEX bugsubscriptionfiltermute__filter__idx ON bugsubscriptionfiltermute USING btree (filter);
18267
CREATE INDEX bugsubscriptionfilterstatus__filter__status__idx ON bugsubscriptionfilterstatus USING btree (filter, status);
18270
CREATE INDEX bugsubscriptionfiltertag__filter__tag__idx ON bugsubscriptionfiltertag USING btree (filter, tag);
18273
CREATE INDEX bugsummary__distribution__idx ON bugsummary USING btree (distribution) WHERE (distribution IS NOT NULL);
18276
CREATE UNIQUE INDEX bugsummary__distribution__unique ON bugsummary USING btree (distribution, status, importance, has_patch, fixed_upstream, (COALESCE(sourcepackagename, (-1))), (COALESCE(tag, ''::text)), (COALESCE(milestone, (-1))), (COALESCE(viewed_by, (-1)))) WHERE (distribution IS NOT NULL);
18279
CREATE INDEX bugsummary__distribution_count__idx ON bugsummary USING btree (distribution) WHERE ((sourcepackagename IS NULL) AND (tag IS NULL));
18282
CREATE INDEX bugsummary__distribution_tag_count__idx ON bugsummary USING btree (distribution) WHERE ((sourcepackagename IS NULL) AND (tag IS NOT NULL));
18285
CREATE INDEX bugsummary__distroseries__idx ON bugsummary USING btree (distroseries) WHERE (distroseries IS NOT NULL);
18288
CREATE UNIQUE INDEX bugsummary__distroseries__unique ON bugsummary USING btree (distroseries, status, importance, has_patch, fixed_upstream, (COALESCE(sourcepackagename, (-1))), (COALESCE(tag, ''::text)), (COALESCE(milestone, (-1))), (COALESCE(viewed_by, (-1)))) WHERE (distroseries IS NOT NULL);
18291
CREATE INDEX bugsummary__full__idx ON bugsummary USING btree (tag, status, product, productseries, distribution, distroseries, sourcepackagename, viewed_by, milestone, importance, has_patch, fixed_upstream);
18294
CREATE INDEX bugsummary__milestone__idx ON bugsummary USING btree (milestone) WHERE (milestone IS NOT NULL);
18297
CREATE INDEX bugsummary__nocount__idx ON bugsummary USING btree (count) WHERE (count = 0);
18300
CREATE INDEX bugsummary__product__idx ON bugsummary USING btree (product) WHERE (product IS NOT NULL);
18303
CREATE UNIQUE INDEX bugsummary__product__unique ON bugsummary USING btree (product, status, importance, has_patch, fixed_upstream, (COALESCE(tag, ''::text)), (COALESCE(milestone, (-1))), (COALESCE(viewed_by, (-1)))) WHERE (product IS NOT NULL);
18306
CREATE INDEX bugsummary__productseries__idx ON bugsummary USING btree (productseries) WHERE (productseries IS NOT NULL);
18309
CREATE UNIQUE INDEX bugsummary__productseries__unique ON bugsummary USING btree (productseries, status, importance, has_patch, fixed_upstream, (COALESCE(tag, ''::text)), (COALESCE(milestone, (-1))), (COALESCE(viewed_by, (-1)))) WHERE (productseries IS NOT NULL);
18312
CREATE INDEX bugsummary__status_count__idx ON bugsummary USING btree (status) WHERE ((sourcepackagename IS NULL) AND (tag IS NULL));
18315
CREATE INDEX bugsummary__tag_count__idx ON bugsummary USING btree (status) WHERE ((sourcepackagename IS NULL) AND (tag IS NOT NULL));
18318
CREATE INDEX bugsummary__viewed_by__idx ON bugsummary USING btree (viewed_by) WHERE (viewed_by IS NOT NULL);
18321
CREATE INDEX bugsummaryjournal__full__idx ON bugsummaryjournal USING btree (status, product, productseries, distribution, distroseries, sourcepackagename, viewed_by, milestone, tag);
18324
CREATE INDEX bugsummaryjournal__milestone__idx ON bugsummaryjournal USING btree (milestone) WHERE (milestone IS NOT NULL);
18327
CREATE INDEX bugsummaryjournal__viewed_by__idx ON bugsummaryjournal USING btree (viewed_by) WHERE (viewed_by IS NOT NULL);
7559
18330
CREATE INDEX bugtag__bug__idx ON bugtag USING btree (bug);
7561
18333
CREATE INDEX bugtask__assignee__idx ON bugtask USING btree (assignee);
7563
18336
CREATE INDEX bugtask__binarypackagename__idx ON bugtask USING btree (binarypackagename) WHERE (binarypackagename IS NOT NULL);
7565
18339
CREATE INDEX bugtask__bug__idx ON bugtask USING btree (bug);
7567
18342
CREATE INDEX bugtask__bugwatch__idx ON bugtask USING btree (bugwatch) WHERE (bugwatch IS NOT NULL);
7569
CREATE UNIQUE INDEX bugtask__date_closed__id__idx ON bugtask USING btree (date_closed, id) WHERE (status = 30);
18345
CREATE INDEX bugtask__date_closed__id__idx2 ON bugtask USING btree (date_closed, id DESC);
7571
18348
CREATE INDEX bugtask__date_incomplete__idx ON bugtask USING btree (date_incomplete) WHERE (date_incomplete IS NOT NULL);
7573
18351
CREATE INDEX bugtask__datecreated__idx ON bugtask USING btree (datecreated);
18354
CREATE INDEX bugtask__distribution__heat__id__idx ON bugtask USING btree (distribution, heat DESC, id) WHERE (distribution IS NOT NULL);
7575
18357
CREATE INDEX bugtask__distribution__sourcepackagename__idx ON bugtask USING btree (distribution, sourcepackagename);
7577
18359
ALTER TABLE bugtask CLUSTER ON bugtask__distribution__sourcepackagename__idx;
18362
CREATE INDEX bugtask__distribution_sourcepackage__heat__idx ON bugtask USING btree (distribution, sourcepackagename, heat) WHERE (distribution IS NOT NULL);
7579
18365
CREATE INDEX bugtask__distroseries__sourcepackagename__idx ON bugtask USING btree (distroseries, sourcepackagename);
18368
CREATE INDEX bugtask__distroseries_sourcepackage__heat__idx ON bugtask USING btree (distroseries, sourcepackagename, heat) WHERE (distroseries IS NOT NULL);
7581
18371
CREATE INDEX bugtask__milestone__idx ON bugtask USING btree (milestone);
7583
18374
CREATE INDEX bugtask__owner__idx ON bugtask USING btree (owner);
7585
18377
CREATE UNIQUE INDEX bugtask__product__bug__key ON bugtask USING btree (product, bug) WHERE (product IS NOT NULL);
18380
CREATE INDEX bugtask__product__heat__id__idx ON bugtask USING btree (product, heat DESC, id) WHERE (product IS NOT NULL);
7587
18383
CREATE UNIQUE INDEX bugtask__productseries__bug__key ON bugtask USING btree (productseries, bug) WHERE (productseries IS NOT NULL);
18386
CREATE INDEX bugtask__productseries__heat__idx ON bugtask USING btree (productseries, heat) WHERE (productseries IS NOT NULL);
7589
18389
CREATE INDEX bugtask__sourcepackagename__idx ON bugtask USING btree (sourcepackagename) WHERE (sourcepackagename IS NOT NULL);
7591
18392
CREATE INDEX bugtask__status__idx ON bugtask USING btree (status);
7593
18395
CREATE UNIQUE INDEX bugtask_distinct_sourcepackage_assignment ON bugtask USING btree (bug, (COALESCE(sourcepackagename, (-1))), (COALESCE(distroseries, (-1))), (COALESCE(distribution, (-1)))) WHERE ((product IS NULL) AND (productseries IS NULL));
7595
CREATE INDEX bugtask_fti ON bugtask USING gist (fti ts2.gist_tsvector_ops);
18398
CREATE INDEX bugtask_fti ON bugtask USING gist (fti);
18401
CREATE INDEX bugtask_importance_idx ON bugtask USING btree (importance, id DESC);
7597
18404
CREATE UNIQUE INDEX bugtracker_name_key ON bugtracker USING btree (name);
7599
18407
CREATE INDEX bugtracker_owner_idx ON bugtracker USING btree (owner);
7601
18410
CREATE INDEX bugtrackeralias__bugtracker__idx ON bugtrackeralias USING btree (bugtracker);
7603
18413
CREATE INDEX bugtrackerperson__person__idx ON bugtrackerperson USING btree (person);
7605
18416
CREATE INDEX bugwatch__lastchecked__idx ON bugwatch USING btree (lastchecked);
7607
18419
CREATE INDEX bugwatch__next_check__idx ON bugwatch USING btree (next_check);
7609
18422
CREATE INDEX bugwatch__remote_lp_bug_id__idx ON bugwatch USING btree (remote_lp_bug_id) WHERE (remote_lp_bug_id IS NOT NULL);
7611
18425
CREATE INDEX bugwatch__remotebug__idx ON bugwatch USING btree (remotebug);
7613
18428
CREATE INDEX bugwatch_bug_idx ON bugwatch USING btree (bug);
7615
18431
CREATE INDEX bugwatch_bugtracker_idx ON bugwatch USING btree (bugtracker);
7617
18434
CREATE INDEX bugwatch_datecreated_idx ON bugwatch USING btree (datecreated);
7619
18437
CREATE INDEX bugwatch_owner_idx ON bugwatch USING btree (owner);
7621
18440
CREATE INDEX bugwatchactivity__bug_watch__idx ON bugwatchactivity USING btree (bug_watch);
7623
18442
ALTER TABLE bugwatchactivity CLUSTER ON bugwatchactivity__bug_watch__idx;
7625
CREATE INDEX bugwatchactivity__date__idx ON bugwatchactivity USING btree (activity_date);
7627
18445
CREATE INDEX builder__owner__idx ON builder USING btree (owner);
7629
18448
CREATE INDEX buildfarmjob__builder_and_status__idx ON buildfarmjob USING btree (builder, status);
7631
18451
CREATE INDEX buildfarmjob__date_created__idx ON buildfarmjob USING btree (date_created);
7633
18454
CREATE INDEX buildfarmjob__date_finished__idx ON buildfarmjob USING btree (date_finished);
7635
18457
CREATE INDEX buildfarmjob__date_started__idx ON buildfarmjob USING btree (date_started);
7637
18460
CREATE INDEX buildfarmjob__log__idx ON buildfarmjob USING btree (log) WHERE (log IS NOT NULL);
7639
18463
CREATE INDEX buildfarmjob__status__idx ON buildfarmjob USING btree (status);
7641
18466
CREATE UNIQUE INDEX buildqueue__builder__id__idx ON buildqueue USING btree (builder, id);
7643
18468
ALTER TABLE buildqueue CLUSTER ON buildqueue__builder__id__idx;
7645
18471
CREATE UNIQUE INDEX buildqueue__builder__unq ON buildqueue USING btree (builder) WHERE (builder IS NOT NULL);
7647
18474
CREATE INDEX buildqueue__job_type__idx ON buildqueue USING btree (job_type);
7649
18477
CREATE INDEX buildqueue__processor__virtualized__idx ON buildqueue USING btree (processor, virtualized) WHERE (processor IS NOT NULL);
7651
18480
CREATE INDEX changeset_datecreated_idx ON revision USING btree (date_created);
7653
18483
CREATE INDEX codeimport__assignee__idx ON codeimport USING btree (assignee);
7655
18486
CREATE UNIQUE INDEX codeimport__cvs_root__cvs_module__key ON codeimport USING btree (cvs_root, cvs_module) WHERE (cvs_root IS NOT NULL);
7657
18489
CREATE INDEX codeimport__owner__idx ON codeimport USING btree (owner);
7659
18492
CREATE INDEX codeimport__registrant__idx ON codeimport USING btree (registrant);
7661
18495
CREATE UNIQUE INDEX codeimport__url__idx ON codeimport USING btree (url) WHERE (url IS NOT NULL);
7663
18498
CREATE INDEX codeimportevent__code_import__date_created__id__idx ON codeimportevent USING btree (code_import, date_created, id);
7665
18501
CREATE INDEX codeimportevent__date_created__id__idx ON codeimportevent USING btree (date_created, id);
7667
18504
CREATE INDEX codeimportevent__message__date_created__idx ON codeimportevent USING btree (machine, date_created) WHERE (machine IS NOT NULL);
7669
18507
CREATE INDEX codeimportevent__person__idx ON codeimportevent USING btree (person) WHERE (person IS NOT NULL);
7671
18510
CREATE INDEX codeimportjob__code_import__date_created__idx ON codeimportjob USING btree (code_import, date_created);
7673
18513
CREATE INDEX codeimportjob__machine__date_created__idx ON codeimportjob USING btree (machine, date_created);
7675
18516
CREATE INDEX codeimportjob__requesting_user__idx ON codeimportjob USING btree (requesting_user);
7677
18519
CREATE INDEX codeimportresult__code_import__date_created__idx ON codeimportresult USING btree (code_import, date_created);
7679
18522
CREATE INDEX codeimportresult__log_file__idx ON codeimportresult USING btree (log_file);
7681
18525
CREATE INDEX codeimportresult__machine__date_created__idx ON codeimportresult USING btree (machine, date_created);
7683
18528
CREATE INDEX codeimportresult__requesting_user__idx ON codeimportresult USING btree (requesting_user);
7685
18531
CREATE INDEX codereviewvote__branch_merge_proposal__idx ON codereviewvote USING btree (branch_merge_proposal);
7687
18534
CREATE INDEX codereviewvote__registrant__idx ON codereviewvote USING btree (registrant);
7689
18537
CREATE INDEX codereviewvote__reviewer__idx ON codereviewvote USING btree (reviewer);
7691
18540
CREATE INDEX codereviewvote__vote_message__idx ON codereviewvote USING btree (vote_message);
7693
18543
CREATE INDEX commercialsubscription__product__idx ON commercialsubscription USING btree (product);
7695
18546
CREATE INDEX commercialsubscription__purchaser__idx ON commercialsubscription USING btree (purchaser);
7697
18549
CREATE INDEX commercialsubscription__registrant__idx ON commercialsubscription USING btree (registrant);
7699
18552
CREATE INDEX commercialsubscription__sales_system_id__idx ON commercialsubscription USING btree (sales_system_id);
7701
18555
CREATE UNIQUE INDEX customlanguagecode__distribution__sourcepackagename__code__key ON customlanguagecode USING btree (distribution, sourcepackagename, language_code) WHERE (distribution IS NOT NULL);
7703
18558
CREATE UNIQUE INDEX customlanguagecode__product__code__key ON customlanguagecode USING btree (product, language_code) WHERE (product IS NOT NULL);
7705
18561
CREATE INDEX cve_datecreated_idx ON cve USING btree (datecreated);
7707
18564
CREATE INDEX cve_datemodified_idx ON cve USING btree (datemodified);
7709
CREATE INDEX cve_fti ON cve USING gist (fti ts2.gist_tsvector_ops);
18567
CREATE INDEX cve_fti ON cve USING gist (fti);
7711
18570
CREATE INDEX cvereference_cve_idx ON cvereference USING btree (cve);
7713
18573
CREATE INDEX diff__diff_text__idx ON diff USING btree (diff_text);
7715
18576
CREATE INDEX distribution__bug_supervisor__idx ON distribution USING btree (bug_supervisor) WHERE (bug_supervisor IS NOT NULL);
7717
18579
CREATE INDEX distribution__driver__idx ON distribution USING btree (driver);
7719
18582
CREATE INDEX distribution__icon__idx ON distribution USING btree (icon) WHERE (icon IS NOT NULL);
7721
18585
CREATE INDEX distribution__language_pack_admin__idx ON distribution USING btree (language_pack_admin);
7723
18588
CREATE INDEX distribution__logo__idx ON distribution USING btree (logo) WHERE (logo IS NOT NULL);
7725
18591
CREATE INDEX distribution__members__idx ON distribution USING btree (members);
7727
18594
CREATE INDEX distribution__mirror_admin__idx ON distribution USING btree (mirror_admin);
7729
18597
CREATE INDEX distribution__mugshot__idx ON distribution USING btree (mugshot) WHERE (mugshot IS NOT NULL);
7731
18600
CREATE INDEX distribution__owner__idx ON distribution USING btree (owner);
18603
CREATE INDEX distribution__registrant__idx ON distribution USING btree (registrant);
7733
18606
CREATE INDEX distribution__security_contact__idx ON distribution USING btree (security_contact);
7735
18609
CREATE INDEX distribution__upload_admin__idx ON distribution USING btree (upload_admin);
7737
CREATE INDEX distribution_fti ON distribution USING gist (fti ts2.gist_tsvector_ops);
18612
CREATE INDEX distribution_fti ON distribution USING gist (fti);
18615
CREATE UNIQUE INDEX distribution_job__initialize_series__distroseries ON distributionjob USING btree (distroseries) WHERE (job_type = 1);
7739
18618
CREATE INDEX distribution_translationgroup_idx ON distribution USING btree (translationgroup);
7741
CREATE INDEX distributionbounty_distribution_idx ON distributionbounty USING btree (distribution);
7743
18621
CREATE UNIQUE INDEX distributionmirror__archive__distribution__country__key ON distributionmirror USING btree (distribution, country, content) WHERE ((country_dns_mirror IS TRUE) AND (content = 1));
7745
18624
CREATE INDEX distributionmirror__country__status__idx ON distributionmirror USING btree (country, status);
7747
18627
CREATE INDEX distributionmirror__owner__idx ON distributionmirror USING btree (owner);
7749
18630
CREATE UNIQUE INDEX distributionmirror__releases__distribution__country__key ON distributionmirror USING btree (distribution, country, content) WHERE ((country_dns_mirror IS TRUE) AND (content = 2));
7751
18633
CREATE INDEX distributionmirror__reviewer__idx ON distributionmirror USING btree (reviewer);
7753
18636
CREATE INDEX distributionmirror__status__idx ON distributionmirror USING btree (status);
7755
18639
CREATE INDEX distributionsourcepackagecache__archive__idx ON distributionsourcepackagecache USING btree (archive);
7757
CREATE INDEX distributionsourcepackagecache_fti ON distributionsourcepackagecache USING gist (fti ts2.gist_tsvector_ops);
18642
CREATE INDEX distributionsourcepackagecache_fti ON distributionsourcepackagecache USING gist (fti);
7759
18645
CREATE INDEX distroarchseries__distroseries__idx ON distroarchseries USING btree (distroseries);
7761
18648
CREATE INDEX distroarchseries__owner__idx ON distroarchseries USING btree (owner);
7763
CREATE INDEX distrocomponentuploader_uploader_idx ON distrocomponentuploader USING btree (uploader);
7765
18651
CREATE INDEX distroseries__driver__idx ON distroseries USING btree (driver) WHERE (driver IS NOT NULL);
7767
CREATE INDEX distroseries__owner__idx ON distroseries USING btree (owner);
18654
CREATE INDEX distroseries__registrant__idx ON distroseries USING btree (registrant);
18657
CREATE INDEX distroseriesdifference__base_version__idx ON distroseriesdifference USING btree (base_version);
18660
CREATE INDEX distroseriesdifference__difference_type__idx ON distroseriesdifference USING btree (difference_type);
18663
CREATE INDEX distroseriesdifference__package_diff__idx ON distroseriesdifference USING btree (package_diff);
18666
CREATE INDEX distroseriesdifference__parent_package_diff__idx ON distroseriesdifference USING btree (parent_package_diff);
18669
CREATE INDEX distroseriesdifference__parent_series__idx ON distroseriesdifference USING btree (parent_series);
18672
CREATE INDEX distroseriesdifference__parent_source_version__idx ON distroseriesdifference USING btree (parent_source_version);
18675
CREATE INDEX distroseriesdifference__source_package_name__idx ON distroseriesdifference USING btree (source_package_name);
18678
CREATE INDEX distroseriesdifference__source_version__idx ON distroseriesdifference USING btree (source_version);
18681
CREATE INDEX distroseriesdifference__status__idx ON distroseriesdifference USING btree (status);
18684
CREATE INDEX distroseriesdifferencemessage__distroseriesdifference__idx ON distroseriesdifferencemessage USING btree (distro_series_difference);
7769
18687
CREATE INDEX distroseriespackagecache__archive__idx ON distroseriespackagecache USING btree (archive);
7771
18690
CREATE INDEX distroseriespackagecache__distroseries__idx ON distroseriespackagecache USING btree (distroseries);
7773
CREATE INDEX distroseriespackagecache_fti ON distroseriespackagecache USING gist (fti ts2.gist_tsvector_ops);
18693
CREATE INDEX distroseriespackagecache_fti ON distroseriespackagecache USING gist (fti);
18696
CREATE INDEX distroseriesparent__derived_series__ordering__idx ON distroseriesparent USING btree (derived_series, ordering);
18699
CREATE INDEX distroseriesparent__parentseries__idx ON distroseriesparent USING btree (parent_series);
7775
18702
CREATE UNIQUE INDEX emailaddress__account__key ON emailaddress USING btree (account) WHERE ((status = 4) AND (account IS NOT NULL));
18705
COMMENT ON INDEX emailaddress__account__key IS 'Ensures that an Account only has one preferred email address';
7777
18708
CREATE INDEX emailaddress__account__status__idx ON emailaddress USING btree (account, status);
7779
18711
CREATE UNIQUE INDEX emailaddress__lower_email__key ON emailaddress USING btree (lower(email));
7781
18714
CREATE UNIQUE INDEX emailaddress__person__key ON emailaddress USING btree (person) WHERE ((status = 4) AND (person IS NOT NULL));
18717
COMMENT ON INDEX emailaddress__person__key IS 'Ensures that a Person only has one preferred email address';
7783
18720
CREATE INDEX emailaddress__person__status__idx ON emailaddress USING btree (person, status);
7785
18723
CREATE INDEX entitlement__approved_by__idx ON entitlement USING btree (approved_by) WHERE (approved_by IS NOT NULL);
7787
18726
CREATE INDEX entitlement__distribution__idx ON entitlement USING btree (distribution) WHERE (distribution IS NOT NULL);
7789
18729
CREATE INDEX entitlement__person__idx ON entitlement USING btree (person);
7791
18732
CREATE INDEX entitlement__product__idx ON entitlement USING btree (product) WHERE (product IS NOT NULL);
7793
18735
CREATE INDEX entitlement__project__idx ON entitlement USING btree (project) WHERE (project IS NOT NULL);
7795
18738
CREATE INDEX entitlement__registrant__idx ON entitlement USING btree (registrant) WHERE (registrant IS NOT NULL);
7797
18741
CREATE INDEX entitlement_lookup_idx ON entitlement USING btree (entitlement_type, date_starts, date_expires, person, state);
7799
18744
CREATE INDEX faq__distribution__idx ON faq USING btree (distribution) WHERE (distribution IS NOT NULL);
7801
18747
CREATE INDEX faq__last_updated_by__idx ON faq USING btree (last_updated_by);
7803
18750
CREATE INDEX faq__owner__idx ON faq USING btree (owner);
7805
18753
CREATE INDEX faq__product__idx ON faq USING btree (product) WHERE (product IS NOT NULL);
7807
CREATE INDEX faq_fti ON faq USING gist (fti ts2.gist_tsvector_ops);
18756
CREATE INDEX faq_fti ON faq USING gist (fti);
7809
18759
CREATE INDEX featuredproject__pillar_name__idx ON featuredproject USING btree (pillar_name);
18762
CREATE INDEX featureflagchangelogentry__person__idx ON featureflagchangelogentry USING btree (person);
7811
18765
CREATE INDEX flatpackagesetinclusion__child__idx ON flatpackagesetinclusion USING btree (child);
7813
18768
CREATE INDEX hwdevice__bus_product_id__idx ON hwdevice USING btree (bus_product_id);
7815
18771
CREATE UNIQUE INDEX hwdevice__bus_vendor_id__bus_product_id__key ON hwdevice USING btree (bus_vendor_id, bus_product_id) WHERE (variant IS NULL);
7817
18774
CREATE INDEX hwdevice__name__idx ON hwdevice USING btree (name);
7819
18777
CREATE UNIQUE INDEX hwdeviceclass__device__main_class__key ON hwdeviceclass USING btree (device, main_class) WHERE (sub_class IS NULL);
7821
18780
CREATE UNIQUE INDEX hwdeviceclass__device__main_class__sub_class__key ON hwdeviceclass USING btree (device, main_class, sub_class) WHERE (sub_class IS NOT NULL);
7823
18783
CREATE INDEX hwdeviceclass__main_class__idx ON hwdeviceclass USING btree (main_class);
7825
18786
CREATE INDEX hwdeviceclass__sub_class__idx ON hwdeviceclass USING btree (sub_class);
7827
18789
CREATE UNIQUE INDEX hwdevicedriverlink__device__driver__key ON hwdevicedriverlink USING btree (device, driver) WHERE (driver IS NOT NULL);
7829
18792
CREATE INDEX hwdevicedriverlink__device__idx ON hwdevicedriverlink USING btree (device);
7831
18795
CREATE UNIQUE INDEX hwdevicedriverlink__device__key ON hwdevicedriverlink USING btree (device) WHERE (driver IS NULL);
7833
18798
CREATE INDEX hwdevicedriverlink__driver__idx ON hwdevicedriverlink USING btree (driver);
7835
18801
CREATE INDEX hwdevicenamevariant__device__idx ON hwdevicenamevariant USING btree (device);
7837
18804
CREATE INDEX hwdevicenamevariant__product_name__idx ON hwdevicenamevariant USING btree (product_name);
7839
18807
CREATE INDEX hwdmihandle__submission__idx ON hwdmihandle USING btree (submission);
7841
18810
CREATE INDEX hwdmivalue__hanlde__idx ON hwdmivalue USING btree (handle);
7843
18813
CREATE INDEX hwdriver__name__idx ON hwdriver USING btree (name);
7845
18816
CREATE UNIQUE INDEX hwdriver__name__key ON hwdriver USING btree (name) WHERE (package_name IS NULL);
18819
CREATE INDEX hwsubmission__date_created__idx ON hwsubmission USING btree (date_created);
18822
CREATE INDEX hwsubmission__date_submitted__idx ON hwsubmission USING btree (date_submitted);
7847
18825
CREATE INDEX hwsubmission__lower_raw_emailaddress__idx ON hwsubmission USING btree (lower(raw_emailaddress));
7849
18828
CREATE INDEX hwsubmission__owner__idx ON hwsubmission USING btree (owner);
7851
18831
CREATE INDEX hwsubmission__raw_emailaddress__idx ON hwsubmission USING btree (raw_emailaddress);
7853
18834
CREATE INDEX hwsubmission__raw_submission__idx ON hwsubmission USING btree (raw_submission);
7855
18837
CREATE INDEX hwsubmission__status__idx ON hwsubmission USING btree (status);
7857
18840
CREATE INDEX hwsubmission__system_fingerprint__idx ON hwsubmission USING btree (system_fingerprint);
7859
18843
CREATE INDEX hwsubmissionbug__bug ON hwsubmissionbug USING btree (bug);
7861
18846
CREATE INDEX hwsubmissiondevice__device_driver_link__idx ON hwsubmissiondevice USING btree (device_driver_link);
18849
CREATE INDEX hwsubmissiondevice__parent__idx ON hwsubmissiondevice USING btree (parent);
7863
18852
CREATE INDEX hwsubmissiondevice__submission__idx ON hwsubmissiondevice USING btree (submission);
7865
18855
CREATE UNIQUE INDEX hwtest__name__version__key ON hwtest USING btree (name, version) WHERE (namespace IS NULL);
7867
18858
CREATE UNIQUE INDEX hwtest__namespace__name__version__key ON hwtest USING btree (namespace, name, version) WHERE (namespace IS NOT NULL);
7869
18861
CREATE INDEX hwtestanswer__choice__idx ON hwtestanswer USING btree (choice);
7871
18864
CREATE INDEX hwtestanswer__submission__idx ON hwtestanswer USING btree (submission);
7873
18867
CREATE INDEX hwtestanswer__test__idx ON hwtestanswer USING btree (test);
7875
18870
CREATE INDEX hwtestanswerchoice__test__idx ON hwtestanswerchoice USING btree (test);
7877
18873
CREATE INDEX hwtestanswercount__choice__idx ON hwtestanswercount USING btree (choice);
7879
18876
CREATE INDEX hwtestanswercount__distroarchrelease__idx ON hwtestanswercount USING btree (distroarchseries) WHERE (distroarchseries IS NOT NULL);
7881
18879
CREATE INDEX hwtestanswercount__test__idx ON hwtestanswercount USING btree (test);
7883
18882
CREATE INDEX hwtestanswercountdevice__device_driver__idx ON hwtestanswercountdevice USING btree (device_driver);
7885
18885
CREATE INDEX hwtestanswerdevice__device_driver__idx ON hwtestanswerdevice USING btree (device_driver);
7887
18888
CREATE INDEX hwvendorid__vendor_id_for_bus__idx ON hwvendorid USING btree (vendor_id_for_bus);
7889
18891
CREATE INDEX hwvendorid__vendorname__idx ON hwvendorid USING btree (vendor_name);
7891
18894
CREATE UNIQUE INDEX hwvendorname__lc_vendor_name__idx ON hwvendorname USING btree (ulower(name));
7893
CREATE INDEX hwvendorname__name__idx ON hwdriver USING btree (name);
18897
CREATE INDEX incrementaldiff__branch_merge_proposal__idx ON incrementaldiff USING btree (branch_merge_proposal);
18900
CREATE INDEX incrementaldiff__diff__idx ON incrementaldiff USING btree (diff);
18903
CREATE INDEX incrementaldiff__new_revision__idx ON incrementaldiff USING btree (new_revision);
18906
CREATE INDEX incrementaldiff__old_revision__idx ON incrementaldiff USING btree (old_revision);
7895
18909
CREATE INDEX ircid_person_idx ON ircid USING btree (person);
7897
18912
CREATE INDEX jabberid_person_idx ON jabberid USING btree (person);
7899
18915
CREATE INDEX job__date_finished__idx ON job USING btree (date_finished) WHERE (date_finished IS NOT NULL);
7901
18918
CREATE INDEX job__lease_expires__idx ON job USING btree (lease_expires);
7903
18921
CREATE INDEX job__requester__key ON job USING btree (requester) WHERE (requester IS NOT NULL);
7905
18924
CREATE INDEX job__scheduled_start__idx ON job USING btree (scheduled_start);
7907
18927
CREATE INDEX karma_person_datecreated_idx ON karma USING btree (person, datecreated);
7909
18929
ALTER TABLE karma CLUSTER ON karma_person_datecreated_idx;
7911
18932
CREATE INDEX karmacache__category__karmavalue__idx ON karmacache USING btree (category, karmavalue) WHERE ((((category IS NOT NULL) AND (product IS NULL)) AND (project IS NULL)) AND (distribution IS NULL));
7913
18935
CREATE INDEX karmacache__distribution__category__karmavalue__idx ON karmacache USING btree (distribution, category, karmavalue) WHERE (((category IS NOT NULL) AND (distribution IS NOT NULL)) AND (sourcepackagename IS NULL));
7915
18938
CREATE INDEX karmacache__distribution__karmavalue__idx ON karmacache USING btree (distribution, karmavalue) WHERE (((category IS NULL) AND (distribution IS NOT NULL)) AND (sourcepackagename IS NULL));
7917
18941
CREATE INDEX karmacache__karmavalue__idx ON karmacache USING btree (karmavalue) WHERE ((((category IS NULL) AND (product IS NULL)) AND (project IS NULL)) AND (distribution IS NULL));
7919
18944
CREATE INDEX karmacache__person__category__idx ON karmacache USING btree (person, category);
7921
18947
CREATE INDEX karmacache__product__category__karmavalue__idx ON karmacache USING btree (product, category, karmavalue) WHERE ((category IS NOT NULL) AND (product IS NOT NULL));
7923
18950
CREATE INDEX karmacache__product__karmavalue__idx ON karmacache USING btree (product, karmavalue) WHERE ((category IS NULL) AND (product IS NOT NULL));
7925
18953
CREATE INDEX karmacache__project__category__karmavalue__idx ON karmacache USING btree (project, category, karmavalue) WHERE (project IS NOT NULL);
7927
18956
CREATE INDEX karmacache__project__karmavalue__idx ON karmacache USING btree (project, karmavalue) WHERE ((category IS NULL) AND (project IS NOT NULL));
7929
18959
CREATE INDEX karmacache__sourcepackagename__category__karmavalue__idx ON karmacache USING btree (sourcepackagename, distribution, category, karmavalue) WHERE ((category IS NOT NULL) AND (sourcepackagename IS NOT NULL));
7931
18962
CREATE INDEX karmacache__sourcepackagename__distribution__karmavalue__idx ON karmacache USING btree (sourcepackagename, distribution, karmavalue) WHERE (sourcepackagename IS NOT NULL);
7933
18965
CREATE INDEX karmacache__sourcepackagename__karmavalue__idx ON karmacache USING btree (sourcepackagename, distribution, karmavalue) WHERE ((category IS NULL) AND (sourcepackagename IS NOT NULL));
7935
18968
CREATE UNIQUE INDEX karmacache__unq ON karmacache USING btree (person, (COALESCE(product, (-1))), (COALESCE(sourcepackagename, (-1))), (COALESCE(project, (-1))), (COALESCE(category, (-1))), (COALESCE(distribution, (-1))));
7937
18971
CREATE INDEX karmacache_person_idx ON karmacache USING btree (person);
7939
18974
CREATE INDEX karmacache_top_in_category_idx ON karmacache USING btree (person, category, karmavalue) WHERE ((((product IS NULL) AND (project IS NULL)) AND (sourcepackagename IS NULL)) AND (distribution IS NULL));
7941
18977
CREATE UNIQUE INDEX karmatotalcache_karma_total_person_idx ON karmatotalcache USING btree (karma_total, person);
7943
18980
CREATE INDEX languagepack__file__idx ON languagepack USING btree (file);
7945
18983
CREATE INDEX libraryfilealias__expires__idx ON libraryfilealias USING btree (expires);
18986
CREATE INDEX libraryfilealias__expires_content_not_null_idx ON libraryfilealias USING btree (expires) WHERE (content IS NOT NULL);
7947
18989
CREATE INDEX libraryfilealias__filename__idx ON libraryfilealias USING btree (filename);
7949
18992
CREATE INDEX libraryfilealias_content_idx ON libraryfilealias USING btree (content);
7951
18995
CREATE INDEX libraryfilecontent__md5__idx ON libraryfilecontent USING btree (md5);
7953
18998
CREATE INDEX libraryfilecontent__sha256__idx ON libraryfilecontent USING btree (sha256);
7955
19001
CREATE INDEX libraryfilecontent_sha1_filesize_idx ON libraryfilecontent USING btree (sha1, filesize);
7957
19004
CREATE INDEX logintoken_requester_idx ON logintoken USING btree (requester);
19007
CREATE INDEX lp_openididentifier__account__idx ON lp_openididentifier USING btree (account);
7959
19010
CREATE INDEX lp_teamparticipation__person__idx ON lp_teamparticipation USING btree (person);
7961
19013
CREATE INDEX mailinglist__date_registered__idx ON mailinglist USING btree (status, date_registered);
7963
19016
CREATE INDEX mailinglist__registrant__idx ON mailinglist USING btree (registrant);
7965
19019
CREATE INDEX mailinglist__reviewer__idx ON mailinglist USING btree (reviewer);
7967
19022
CREATE UNIQUE INDEX mailinglist__team__status__key ON mailinglist USING btree (team, status);
7969
CREATE INDEX mailinglistban__banned_by__idx ON mailinglistban USING btree (banned_by);
7971
CREATE INDEX mailinglistban__person__idx ON mailinglistban USING btree (person);
7973
19025
CREATE INDEX mailinglistsubscription__email_address__idx ON mailinglistsubscription USING btree (email_address) WHERE (email_address IS NOT NULL);
7975
19028
CREATE INDEX mailinglistsubscription__mailing_list__idx ON mailinglistsubscription USING btree (mailing_list);
7977
19031
CREATE UNIQUE INDEX mailinglistsubscription__person__mailing_list__key ON mailinglistsubscription USING btree (person, mailing_list);
7979
CREATE INDEX mentoringoffer__owner__idx ON mentoringoffer USING btree (owner);
7981
CREATE INDEX mentoringoffer__team__idx ON mentoringoffer USING btree (team);
7983
19034
CREATE INDEX mergedirectivejob__merge_directive__idx ON mergedirectivejob USING btree (merge_directive);
7985
CREATE INDEX message_fti ON message USING gist (fti ts2.gist_tsvector_ops);
19037
CREATE INDEX message__datecreated__idx ON message USING btree (datecreated);
19040
CREATE INDEX message_fti ON message USING gist (fti);
7987
19043
CREATE INDEX message_owner_idx ON message USING btree (owner);
7989
19046
CREATE INDEX message_parent_idx ON message USING btree (parent);
7991
19049
CREATE INDEX message_raw_idx ON message USING btree (raw) WHERE (raw IS NOT NULL);
7993
19052
CREATE INDEX message_rfc822msgid_idx ON message USING btree (rfc822msgid);
7995
19055
CREATE INDEX messageapproval__disposed_by__idx ON messageapproval USING btree (disposed_by) WHERE (disposed_by IS NOT NULL);
7997
19058
CREATE INDEX messageapproval__mailing_list__status__posted_date__idx ON messageapproval USING btree (mailing_list, status, posted_date);
7999
19061
CREATE INDEX messageapproval__message__idx ON messageapproval USING btree (message);
8001
19064
CREATE INDEX messageapproval__posted_by__idx ON messageapproval USING btree (posted_by);
8003
19067
CREATE INDEX messageapproval__posted_message__idx ON messageapproval USING btree (posted_message);
8005
19070
CREATE INDEX messagechunk_blob_idx ON messagechunk USING btree (blob) WHERE (blob IS NOT NULL);
8007
CREATE INDEX messagechunk_fti ON messagechunk USING gist (fti ts2.gist_tsvector_ops);
19073
CREATE INDEX messagechunk_fti ON messagechunk USING gist (fti);
19076
CREATE INDEX milestone_dateexpected_name_sort ON milestone USING btree (milestone_sort_key(dateexpected, name));
8009
19079
CREATE INDEX mirror__owner__idx ON mirror USING btree (owner);
8011
19082
CREATE UNIQUE INDEX mirrordistroarchseries_uniq ON mirrordistroarchseries USING btree (distribution_mirror, distroarchseries, component, pocket);
8013
19085
CREATE UNIQUE INDEX mirrordistroseriessource_uniq ON mirrordistroseriessource USING btree (distribution_mirror, distroseries, component, pocket);
8015
19088
CREATE INDEX mirrorproberecord__date_created__idx ON mirrorproberecord USING btree (date_created);
8017
19091
CREATE INDEX mirrorproberecord__distribution_mirror__date_created__idx ON mirrorproberecord USING btree (distribution_mirror, date_created);
8019
19094
CREATE INDEX mirrorproberecord__log_file__idx ON mirrorproberecord USING btree (log_file) WHERE (log_file IS NOT NULL);
8021
19097
CREATE INDEX oauthaccesstoken__consumer__idx ON oauthaccesstoken USING btree (consumer);
8023
19100
CREATE INDEX oauthaccesstoken__date_expires__idx ON oauthaccesstoken USING btree (date_expires) WHERE (date_expires IS NOT NULL);
8025
19103
CREATE INDEX oauthaccesstoken__distribution__sourcepackagename__idx ON oauthaccesstoken USING btree (distribution, sourcepackagename) WHERE (distribution IS NOT NULL);
8027
19106
CREATE INDEX oauthaccesstoken__person__idx ON oauthaccesstoken USING btree (person);
8029
19109
CREATE INDEX oauthaccesstoken__product__idx ON oauthaccesstoken USING btree (product) WHERE (product IS NOT NULL);
8031
19112
CREATE INDEX oauthaccesstoken__project__idx ON oauthaccesstoken USING btree (project) WHERE (project IS NOT NULL);
8033
19115
CREATE INDEX oauthnonce__access_token__idx ON oauthnonce USING btree (access_token);
8035
19118
CREATE INDEX oauthnonce__request_timestamp__idx ON oauthnonce USING btree (request_timestamp);
8037
19121
CREATE INDEX oauthrequesttoken__consumer__idx ON oauthrequesttoken USING btree (consumer);
8039
19124
CREATE INDEX oauthrequesttoken__date_created__idx ON oauthrequesttoken USING btree (date_created);
8041
19127
CREATE INDEX oauthrequesttoken__distribution__sourcepackagename__idx ON oauthrequesttoken USING btree (distribution, sourcepackagename) WHERE (distribution IS NOT NULL);
8043
19130
CREATE INDEX oauthrequesttoken__person__idx ON oauthrequesttoken USING btree (person) WHERE (person IS NOT NULL);
8045
19133
CREATE INDEX oauthrequesttoken__product__idx ON oauthrequesttoken USING btree (product) WHERE (product IS NOT NULL);
8047
19136
CREATE INDEX oauthrequesttoken__project__idx ON oauthrequesttoken USING btree (project) WHERE (project IS NOT NULL);
8049
19139
CREATE UNIQUE INDEX officialbugtag__distribution__tag__key ON officialbugtag USING btree (distribution, tag) WHERE (distribution IS NOT NULL);
8051
19142
CREATE UNIQUE INDEX officialbugtag__product__tag__key ON officialbugtag USING btree (product, tag) WHERE (product IS NOT NULL);
8053
19145
CREATE UNIQUE INDEX officialbugtag__project__tag__key ON officialbugtag USING btree (project, tag) WHERE (product IS NOT NULL);
8055
CREATE INDEX openidrpconfig__logo__idx ON openidrpconfig USING btree (logo);
8057
CREATE UNIQUE INDEX openidrpconfig__trust_root__key ON openidrpconfig USING btree (trust_root);
8059
CREATE INDEX openidrpsummary__openid_identifier__idx ON openidrpsummary USING btree (openid_identifier);
8061
CREATE INDEX openidrpsummary__trust_root__idx ON openidrpsummary USING btree (trust_root);
8063
CREATE INDEX packagebugsupervisor__bug_supervisor__idx ON packagebugsupervisor USING btree (bug_supervisor);
19148
CREATE INDEX openididentifier__account__idx ON openididentifier USING btree (account);
8065
19151
CREATE INDEX packagebuild__archive__idx ON packagebuild USING btree (archive);
8067
19154
CREATE UNIQUE INDEX packagebuild__build_farm_job__idx ON packagebuild USING btree (build_farm_job);
8069
19157
CREATE INDEX packagebuild__upload_log__idx ON packagebuild USING btree (upload_log) WHERE (upload_log IS NOT NULL);
19160
CREATE UNIQUE INDEX packagecopyjob__job_type__target_ds__id__key ON packagecopyjob USING btree (job_type, target_distroseries, id);
19163
CREATE INDEX packagecopyjob__source ON packagecopyjob USING btree (source_archive);
19166
CREATE INDEX packagecopyjob__target ON packagecopyjob USING btree (target_archive, target_distroseries);
8071
19169
CREATE INDEX packagecopyrequest__datecreated__idx ON packagecopyrequest USING btree (date_created);
8073
19172
CREATE INDEX packagecopyrequest__requester__idx ON packagecopyrequest USING btree (requester);
8075
19175
CREATE INDEX packagecopyrequest__targetarchive__idx ON packagecopyrequest USING btree (target_archive);
8077
19178
CREATE INDEX packagecopyrequest__targetdistroseries__idx ON packagecopyrequest USING btree (target_distroseries) WHERE (target_distroseries IS NOT NULL);
8079
19181
CREATE INDEX packagediff__diff_content__idx ON packagediff USING btree (diff_content);
8081
19184
CREATE INDEX packagediff__from_source__idx ON packagediff USING btree (from_source);
8083
19187
CREATE INDEX packagediff__requester__idx ON packagediff USING btree (requester);
8085
19190
CREATE INDEX packagediff__status__idx ON packagediff USING btree (status);
8087
19193
CREATE INDEX packagediff__to_source__idx ON packagediff USING btree (to_source);
8089
19196
CREATE INDEX packageset__distroseries__idx ON packageset USING btree (distroseries);
8091
19199
CREATE INDEX packageset__owner__idx ON packageset USING btree (owner);
8093
19202
CREATE INDEX packageset__packagesetgroup__idx ON packageset USING btree (packagesetgroup);
8095
19205
CREATE INDEX packagesetgroup__owner__idx ON packagesetgroup USING btree (owner);
8097
19208
CREATE INDEX packagesetinclusion__child__idx ON packagesetinclusion USING btree (child);
8099
19211
CREATE INDEX packagesetsources__sourcepackagename__idx ON packagesetsources USING btree (sourcepackagename);
19214
CREATE INDEX packageupload__archive__distroseries__status__idx ON packageupload USING btree (archive, distroseries, status);
8101
19217
CREATE INDEX packageupload__changesfile__idx ON packageupload USING btree (changesfile);
8103
19220
CREATE INDEX packageupload__distroseries__key ON packageupload USING btree (distroseries);
8105
19223
CREATE INDEX packageupload__distroseries__status__idx ON packageupload USING btree (distroseries, status);
19226
CREATE INDEX packageupload__package_copy_job__idx ON packageupload USING btree (package_copy_job) WHERE (package_copy_job IS NOT NULL);
8107
19229
CREATE INDEX packageupload__signing_key__idx ON packageupload USING btree (signing_key);
8109
19232
CREATE INDEX packageuploadbuild__build__idx ON packageuploadbuild USING btree (build);
8111
19235
CREATE INDEX packageuploadcustom__libraryfilealias__idx ON packageuploadcustom USING btree (libraryfilealias);
8113
19238
CREATE INDEX packageuploadcustom__packageupload__idx ON packageuploadcustom USING btree (packageupload);
8115
19241
CREATE INDEX packageuploadsource__sourcepackagerelease__idx ON packageuploadsource USING btree (sourcepackagerelease);
8117
CREATE INDEX packaging__distroseries__sourcepackagename__idx ON packaging USING btree (distroseries, sourcepackagename);
8119
19244
CREATE INDEX packaging__owner__idx ON packaging USING btree (owner);
8121
19247
CREATE INDEX packaging_sourcepackagename_idx ON packaging USING btree (sourcepackagename);
19250
CREATE INDEX packagingjob__job__idx ON packagingjob USING btree (job);
19253
CREATE INDEX packagingjob__potemplate__idx ON packagingjob USING btree (potemplate);
8123
19256
CREATE INDEX parsedapachelog__first_line__idx ON parsedapachelog USING btree (first_line);
19259
CREATE INDEX person__displayname__idx ON person USING btree (lower(displayname));
8125
19262
CREATE INDEX person__icon__idx ON person USING btree (icon) WHERE (icon IS NOT NULL);
8127
19265
CREATE INDEX person__logo__idx ON person USING btree (logo) WHERE (logo IS NOT NULL);
8129
19268
CREATE INDEX person__merged__idx ON person USING btree (merged) WHERE (merged IS NOT NULL);
8131
19271
CREATE INDEX person__mugshot__idx ON person USING btree (mugshot) WHERE (mugshot IS NOT NULL);
8133
19274
CREATE INDEX person__registrant__idx ON person USING btree (registrant);
8135
19277
CREATE INDEX person__teamowner__idx ON person USING btree (teamowner) WHERE (teamowner IS NOT NULL);
8137
19280
CREATE INDEX person_datecreated_idx ON person USING btree (datecreated);
8139
CREATE INDEX person_fti ON person USING gist (fti ts2.gist_tsvector_ops);
19283
CREATE INDEX person_fti ON person USING gist (fti);
8141
19286
CREATE INDEX person_sorting_idx ON person USING btree (person_sort_key(displayname, name));
8143
19289
CREATE INDEX personlocation__last_modified_by__idx ON personlocation USING btree (last_modified_by);
8145
19292
CREATE INDEX personnotification__date_emailed__idx ON personnotification USING btree (date_emailed);
8147
19295
CREATE INDEX personnotification__person__idx ON personnotification USING btree (person);
19298
CREATE INDEX persontransferjob__major_person__idx ON persontransferjob USING btree (major_person);
19301
CREATE INDEX persontransferjob__minor_person__idx ON persontransferjob USING btree (minor_person);
8149
19304
CREATE INDEX pillarname__alias_for__idx ON pillarname USING btree (alias_for) WHERE (alias_for IS NOT NULL);
8151
19307
CREATE UNIQUE INDEX pillarname__distribution__key ON pillarname USING btree (distribution) WHERE (distribution IS NOT NULL);
8153
19310
CREATE UNIQUE INDEX pillarname__product__key ON pillarname USING btree (product) WHERE (product IS NOT NULL);
8155
19313
CREATE UNIQUE INDEX pillarname__project__key ON pillarname USING btree (project) WHERE (project IS NOT NULL);
8157
19316
CREATE INDEX pocketchroot__chroot__idx ON pocketchroot USING btree (chroot);
8159
CREATE INDEX pocomment_person_idx ON pocomment USING btree (person);
8161
19319
CREATE INDEX poexportrequest__person__idx ON poexportrequest USING btree (person);
8163
19322
CREATE UNIQUE INDEX poexportrequest_duplicate_key ON poexportrequest USING btree (potemplate, person, format, (COALESCE(pofile, (-1))));
8165
19325
CREATE INDEX pofile__from_sourcepackagename__idx ON pofile USING btree (from_sourcepackagename) WHERE (from_sourcepackagename IS NOT NULL);
19328
CREATE UNIQUE INDEX pofile__potemplate__language__idx ON pofile USING btree (potemplate, language);
8167
19331
CREATE UNIQUE INDEX pofile__potemplate__path__key ON pofile USING btree (potemplate, path);
8169
19334
CREATE UNIQUE INDEX pofile__unreviewed_count__id__key ON pofile USING btree (unreviewed_count, id);
8171
19337
CREATE INDEX pofile_datecreated_idx ON pofile USING btree (datecreated);
8173
19340
CREATE INDEX pofile_language_idx ON pofile USING btree (language);
8175
19343
CREATE INDEX pofile_lasttranslator_idx ON pofile USING btree (lasttranslator);
8177
19346
CREATE INDEX pofile_owner_idx ON pofile USING btree (owner);
8179
CREATE UNIQUE INDEX pofile_template_and_language_idx ON pofile USING btree (potemplate, language, (COALESCE(variant, ''::text)));
8181
ALTER TABLE pofile CLUSTER ON pofile_template_and_language_idx;
8183
CREATE INDEX pofile_variant_idx ON pofile USING btree (variant);
8185
19349
CREATE INDEX pofiletranslator__date_last_touched__idx ON pofiletranslator USING btree (date_last_touched);
8187
19352
CREATE INDEX pofiletranslator__latest_message__idx ON pofiletranslator USING btree (latest_message);
8189
19355
CREATE INDEX pofiletranslator__pofile__idx ON pofiletranslator USING btree (pofile);
8191
19358
CREATE INDEX polloption_poll_idx ON polloption USING btree (poll);
8193
19361
CREATE UNIQUE INDEX pomsgid_msgid_key ON pomsgid USING btree (sha1(msgid));
8195
19364
CREATE INDEX potemplate__date_last_updated__idx ON potemplate USING btree (date_last_updated);
8197
19367
CREATE UNIQUE INDEX potemplate__distroseries__sourcepackagename__name__key ON potemplate USING btree (distroseries, sourcepackagename, name);
8199
19370
CREATE INDEX potemplate__name__idx ON potemplate USING btree (name);
8201
19373
CREATE UNIQUE INDEX potemplate__productseries__name__key ON potemplate USING btree (productseries, name);
8203
19376
CREATE INDEX potemplate__source_file__idx ON potemplate USING btree (source_file) WHERE (source_file IS NOT NULL);
8205
19379
CREATE INDEX potemplate_languagepack_idx ON potemplate USING btree (languagepack);
8207
19382
CREATE INDEX potemplate_owner_idx ON potemplate USING btree (owner);
8209
19385
CREATE INDEX potmsgset__context__msgid_singular__msgid_plural__idx ON potmsgset USING btree (context, msgid_singular, msgid_plural) WHERE ((context IS NOT NULL) AND (msgid_plural IS NOT NULL));
8211
19388
CREATE INDEX potmsgset__context__msgid_singular__no_msgid_plural__idx ON potmsgset USING btree (context, msgid_singular) WHERE ((context IS NOT NULL) AND (msgid_plural IS NULL));
8213
19391
CREATE INDEX potmsgset__no_context__msgid_singular__msgid_plural__idx ON potmsgset USING btree (msgid_singular, msgid_plural) WHERE ((context IS NULL) AND (msgid_plural IS NOT NULL));
8215
19394
CREATE INDEX potmsgset__no_context__msgid_singular__no_msgid_plural__idx ON potmsgset USING btree (msgid_singular) WHERE ((context IS NULL) AND (msgid_plural IS NULL));
19397
CREATE INDEX potmsgset__potemplate__idx ON potmsgset USING btree (potemplate) WHERE (potemplate IS NOT NULL);
8217
19400
CREATE INDEX potmsgset_primemsgid_idx ON potmsgset USING btree (msgid_singular);
8219
CREATE INDEX potmsgset_sequence_idx ON potmsgset USING btree (sequence);
8221
19403
CREATE UNIQUE INDEX potranslation_translation_key ON potranslation USING btree (sha1(translation));
8223
19406
CREATE INDEX previewdiff__diff__idx ON previewdiff USING btree (diff);
8225
19409
CREATE INDEX product__bug_supervisor__idx ON product USING btree (bug_supervisor) WHERE (bug_supervisor IS NOT NULL);
8227
19412
CREATE INDEX product__driver__idx ON product USING btree (driver) WHERE (driver IS NOT NULL);
8229
19415
CREATE INDEX product__icon__idx ON product USING btree (icon) WHERE (icon IS NOT NULL);
8231
19418
CREATE INDEX product__logo__idx ON product USING btree (logo) WHERE (logo IS NOT NULL);
8233
19421
CREATE INDEX product__mugshot__idx ON product USING btree (mugshot) WHERE (mugshot IS NOT NULL);
8235
19424
CREATE INDEX product__registrant__idx ON product USING btree (registrant);
8237
19427
CREATE INDEX product__security_contact__idx ON product USING btree (security_contact) WHERE (security_contact IS NOT NULL);
8239
19430
CREATE INDEX product_active_idx ON product USING btree (active);
8241
CREATE INDEX product_bugcontact_idx ON product USING btree (bug_supervisor);
8243
CREATE INDEX product_fti ON product USING gist (fti ts2.gist_tsvector_ops);
19433
CREATE INDEX product_fti ON product USING gist (fti);
8245
19436
CREATE INDEX product_owner_idx ON product USING btree (owner);
8247
19439
CREATE INDEX product_project_idx ON product USING btree (project);
8249
19442
CREATE INDEX product_translationgroup_idx ON product USING btree (translationgroup);
8251
19445
CREATE INDEX productlicense__license__idx ON productlicense USING btree (license);
8253
19448
CREATE INDEX productrelease_datecreated_idx ON productrelease USING btree (datecreated);
8255
19451
CREATE INDEX productrelease_owner_idx ON productrelease USING btree (owner);
8257
19454
CREATE INDEX productreleasefile__libraryfile__idx ON productreleasefile USING btree (libraryfile);
8259
19457
CREATE INDEX productreleasefile__signature__idx ON productreleasefile USING btree (signature) WHERE (signature IS NOT NULL);
8261
19460
CREATE INDEX productreleasefile__uploader__idx ON productreleasefile USING btree (uploader);
8263
CREATE INDEX productreleasefile_fti ON productreleasefile USING gist (fti ts2.gist_tsvector_ops);
19463
CREATE INDEX productreleasefile_fti ON productreleasefile USING gist (fti);
8265
19466
CREATE INDEX productseries__branch__idx ON productseries USING btree (branch) WHERE (branch IS NOT NULL);
8267
19469
CREATE INDEX productseries__driver__idx ON productseries USING btree (driver);
8269
19472
CREATE INDEX productseries__owner__idx ON productseries USING btree (owner);
8271
19475
CREATE INDEX productseries__translations_branch__idx ON productseries USING btree (translations_branch);
8273
19478
CREATE INDEX productseries_datecreated_idx ON productseries USING btree (datecreated);
19481
CREATE INDEX productseries_name_sort ON productseries USING btree (version_sort_key(name));
8275
19484
CREATE INDEX project__driver__idx ON project USING btree (driver);
8277
19487
CREATE INDEX project__icon__idx ON project USING btree (icon) WHERE (icon IS NOT NULL);
8279
19490
CREATE INDEX project__logo__idx ON project USING btree (logo) WHERE (logo IS NOT NULL);
8281
19493
CREATE INDEX project__mugshot__idx ON project USING btree (mugshot) WHERE (mugshot IS NOT NULL);
8283
19496
CREATE INDEX project__registrant__idx ON project USING btree (registrant);
8285
CREATE INDEX project_fti ON project USING gist (fti ts2.gist_tsvector_ops);
19499
CREATE INDEX project_fti ON project USING gist (fti);
8287
19502
CREATE INDEX project_owner_idx ON project USING btree (owner);
8289
19505
CREATE INDEX project_translationgroup_idx ON project USING btree (translationgroup);
8291
CREATE INDEX pushmirroraccess_person_idx ON pushmirroraccess USING btree (person);
19508
CREATE UNIQUE INDEX publisherconfig__distribution__idx ON publisherconfig USING btree (distribution);
8293
19511
CREATE INDEX question__answerer__idx ON question USING btree (answerer);
8295
19514
CREATE INDEX question__assignee__idx ON question USING btree (assignee);
8297
19517
CREATE INDEX question__distribution__sourcepackagename__idx ON question USING btree (distribution, sourcepackagename);
8299
19520
CREATE INDEX question__distro__datecreated__idx ON question USING btree (distribution, datecreated);
8301
19523
CREATE INDEX question__faq__idx ON question USING btree (faq) WHERE (faq IS NOT NULL);
8303
19526
CREATE INDEX question__owner__idx ON question USING btree (owner);
8305
19529
CREATE INDEX question__product__datecreated__idx ON question USING btree (product, datecreated);
8307
19532
CREATE INDEX question__product__idx ON question USING btree (product);
8309
19535
CREATE INDEX question__status__datecreated__idx ON question USING btree (status, datecreated);
8311
CREATE INDEX question_fti ON question USING gist (fti ts2.gist_tsvector_ops);
19538
CREATE INDEX question_fti ON question USING gist (fti);
8313
19541
CREATE INDEX questionbug__question__idx ON questionbug USING btree (question);
19544
CREATE INDEX questionjob__question__idx ON questionjob USING btree (question);
19547
CREATE INDEX questionmessage__owner__idx ON questionmessage USING btree (owner);
8315
19550
CREATE INDEX questionmessage__question__idx ON questionmessage USING btree (question);
8317
19553
CREATE INDEX questionreopening__answerer__idx ON questionreopening USING btree (answerer);
8319
19556
CREATE INDEX questionreopening__datecreated__idx ON questionreopening USING btree (datecreated);
8321
19559
CREATE INDEX questionreopening__question__idx ON questionreopening USING btree (question);
8323
19562
CREATE INDEX questionreopening__reopener__idx ON questionreopening USING btree (reopener);
8325
19565
CREATE INDEX questionsubscription__subscriber__idx ON questionsubscription USING btree (person);
8327
CREATE INDEX requestedcds_request_architecture_idx ON requestedcds USING btree (request, architecture);
8329
19568
CREATE INDEX revision__gpgkey__idx ON revision USING btree (gpgkey) WHERE (gpgkey IS NOT NULL);
8331
19571
CREATE INDEX revision__karma_allocated__idx ON revision USING btree (karma_allocated) WHERE (karma_allocated IS FALSE);
8333
19574
CREATE INDEX revision__revision_author__idx ON revision USING btree (revision_author);
8335
19577
CREATE INDEX revision__revision_date__idx ON revision USING btree (revision_date);
8337
19580
CREATE INDEX revisionauthor__email__idx ON revisionauthor USING btree (email);
8339
19583
CREATE INDEX revisionauthor__lower_email__idx ON revisionauthor USING btree (lower(email));
8341
19586
CREATE INDEX revisionauthor__person__idx ON revisionauthor USING btree (person);
8343
19589
CREATE UNIQUE INDEX revisioncache__distroseries__sourcepackagename__revision__priva ON revisioncache USING btree (distroseries, sourcepackagename, revision, private) WHERE (distroseries IS NOT NULL);
8345
19592
CREATE UNIQUE INDEX revisioncache__product__revision__private__key ON revisioncache USING btree (product, revision, private) WHERE (product IS NOT NULL);
8347
19595
CREATE INDEX revisioncache__revision__idx ON revisioncache USING btree (revision);
8349
19598
CREATE INDEX revisioncache__revision_author__idx ON revisioncache USING btree (revision_author);
8351
19601
CREATE INDEX revisioncache__revision_date__idx ON revisioncache USING btree (revision_date);
8353
19604
CREATE INDEX sbpph__dateremoved__idx ON binarypackagepublishinghistory USING btree (dateremoved) WHERE (dateremoved IS NOT NULL);
8355
19607
CREATE INDEX scriptactivity__name__date_started__idx ON scriptactivity USING btree (name, date_started);
8357
19610
CREATE INDEX securebinarypackagepublishinghistory__archive__status__idx ON binarypackagepublishinghistory USING btree (archive, status);
8359
19613
CREATE INDEX securebinarypackagepublishinghistory__distroarchseries__idx ON binarypackagepublishinghistory USING btree (distroarchseries);
8361
19616
CREATE INDEX securebinarypackagepublishinghistory__removed_by__idx ON binarypackagepublishinghistory USING btree (removed_by) WHERE (removed_by IS NOT NULL);
8363
19619
CREATE INDEX securebinarypackagepublishinghistory__supersededby__idx ON binarypackagepublishinghistory USING btree (supersededby);
8365
19622
CREATE INDEX securebinarypackagepublishinghistory_binarypackagerelease_idx ON binarypackagepublishinghistory USING btree (binarypackagerelease);
8367
19625
CREATE INDEX securebinarypackagepublishinghistory_component_idx ON binarypackagepublishinghistory USING btree (component);
8369
19628
CREATE INDEX securebinarypackagepublishinghistory_pocket_idx ON binarypackagepublishinghistory USING btree (pocket);
8371
19631
CREATE INDEX securebinarypackagepublishinghistory_section_idx ON binarypackagepublishinghistory USING btree (section);
8373
19634
CREATE INDEX securebinarypackagepublishinghistory_status_idx ON binarypackagepublishinghistory USING btree (status);
8375
19637
CREATE INDEX securesourcepackagepublishinghistory__archive__status__idx ON sourcepackagepublishinghistory USING btree (archive, status);
8377
19640
CREATE INDEX securesourcepackagepublishinghistory__distroseries__idx ON sourcepackagepublishinghistory USING btree (distroseries);
8379
19643
CREATE INDEX securesourcepackagepublishinghistory__removed_by__idx ON sourcepackagepublishinghistory USING btree (removed_by) WHERE (removed_by IS NOT NULL);
8381
19646
CREATE INDEX securesourcepackagepublishinghistory_component_idx ON sourcepackagepublishinghistory USING btree (component);
8383
19649
CREATE INDEX securesourcepackagepublishinghistory_pocket_idx ON sourcepackagepublishinghistory USING btree (pocket);
8385
19652
CREATE INDEX securesourcepackagepublishinghistory_section_idx ON sourcepackagepublishinghistory USING btree (section);
8387
19655
CREATE INDEX securesourcepackagepublishinghistory_sourcepackagerelease_idx ON sourcepackagepublishinghistory USING btree (sourcepackagerelease);
8389
19658
CREATE INDEX securesourcepackagepublishinghistory_status_idx ON sourcepackagepublishinghistory USING btree (status);
8391
19661
CREATE INDEX seriessourcepackagebranch__branch__idx ON seriessourcepackagebranch USING btree (branch);
8393
19664
CREATE INDEX seriessourcepackagebranch__registrant__key ON seriessourcepackagebranch USING btree (registrant);
8395
CREATE INDEX shipitreport__csvfile__idx ON shipitreport USING btree (csvfile);
8397
CREATE INDEX shipitsurvey__account__idx ON shipitsurvey USING btree (account);
8399
CREATE UNIQUE INDEX shipitsurvey__unexported__key ON shipitsurvey USING btree (id) WHERE (exported IS FALSE);
8401
CREATE INDEX shipitsurveyresult__survey__question__answer__idx ON shipitsurveyresult USING btree (survey, question, answer);
8403
CREATE INDEX shipment_shippingrun_idx ON shipment USING btree (shippingrun);
8405
CREATE INDEX shippingrequest__daterequested__approved__idx ON shippingrequest USING btree (daterequested) WHERE (status = 1);
8407
CREATE INDEX shippingrequest__daterequested__unapproved__idx ON shippingrequest USING btree (daterequested) WHERE (status = 0);
8409
CREATE INDEX shippingrequest__normalized_address__idx ON shippingrequest USING btree (normalized_address);
8411
CREATE INDEX shippingrequest__whocancelled__idx ON shippingrequest USING btree (whocancelled) WHERE (whocancelled IS NOT NULL);
8413
CREATE INDEX shippingrequest_daterequested_idx ON shippingrequest USING btree (daterequested);
8415
ALTER TABLE shippingrequest CLUSTER ON shippingrequest_daterequested_idx;
8417
CREATE INDEX shippingrequest_fti ON shippingrequest USING gist (fti ts2.gist_tsvector_ops);
8419
CREATE INDEX shippingrequest_highpriority_idx ON shippingrequest USING btree (highpriority);
8421
CREATE UNIQUE INDEX shippingrequest_one_outstanding_request_unique ON shippingrequest USING btree (recipient) WHERE (((shipment IS NULL) AND (is_admin_request IS NOT TRUE)) AND (status <> ALL (ARRAY[2, 3])));
8423
CREATE INDEX shippingrequest_recipient_idx ON shippingrequest USING btree (recipient);
8425
CREATE INDEX shippingrequest_whoapproved_idx ON shippingrequest USING btree (whoapproved);
8427
19667
CREATE INDEX signedcodeofconduct_owner_idx ON signedcodeofconduct USING btree (owner);
19670
CREATE INDEX sourcepackagepublishinghistory__ancestor__idx ON sourcepackagepublishinghistory USING btree (ancestor);
19673
CREATE INDEX sourcepackagepublishinghistory__creator__idx ON sourcepackagepublishinghistory USING btree (creator) WHERE (creator IS NOT NULL);
19676
CREATE INDEX sourcepackagepublishinghistory__sourcepackagename__idx ON sourcepackagepublishinghistory USING btree (sourcepackagename);
8429
19679
CREATE INDEX sourcepackagerecipe__daily_build_archive__idx ON sourcepackagerecipe USING btree (daily_build_archive);
8431
19682
CREATE INDEX sourcepackagerecipe__is_stale__build_daily__idx ON sourcepackagerecipe USING btree (is_stale, build_daily);
8433
19685
CREATE INDEX sourcepackagerecipe__registrant__idx ON sourcepackagerecipe USING btree (registrant);
8435
19688
CREATE INDEX sourcepackagerecipebuild__distroseries__idx ON sourcepackagerecipebuild USING btree (distroseries);
8437
19691
CREATE INDEX sourcepackagerecipebuild__manifest__idx ON sourcepackagerecipebuild USING btree (manifest);
8439
19694
CREATE INDEX sourcepackagerecipebuild__recipe__idx ON sourcepackagerecipebuild USING btree (recipe);
8441
19697
CREATE INDEX sourcepackagerecipebuild__requester__idx ON sourcepackagerecipebuild USING btree (requester);
8443
19700
CREATE INDEX sourcepackagerecipedata__base_branch__idx ON sourcepackagerecipedata USING btree (base_branch);
8445
19703
CREATE UNIQUE INDEX sourcepackagerecipedata__sourcepackage_recipe__key ON sourcepackagerecipedata USING btree (sourcepackage_recipe) WHERE (sourcepackage_recipe IS NOT NULL);
8447
19706
CREATE UNIQUE INDEX sourcepackagerecipedata__sourcepackage_recipe_build__key ON sourcepackagerecipedata USING btree (sourcepackage_recipe_build) WHERE (sourcepackage_recipe_build IS NOT NULL);
8449
19709
CREATE INDEX sourcepackagerecipedatainstruction__branch__idx ON sourcepackagerecipedatainstruction USING btree (branch);
8451
19712
CREATE INDEX sourcepackagerelease__changelog__idx ON sourcepackagerelease USING btree (changelog);
8453
19715
CREATE INDEX sourcepackagerelease__sourcepackage_recipe_build__idx ON sourcepackagerelease USING btree (sourcepackage_recipe_build);
8455
19718
CREATE INDEX sourcepackagerelease__upload_archive__idx ON sourcepackagerelease USING btree (upload_archive);
19721
CREATE INDEX sourcepackagerelease__version__idx ON sourcepackagerelease USING btree (version);
8457
19724
CREATE INDEX sourcepackagerelease_creator_idx ON sourcepackagerelease USING btree (creator);
8459
19727
CREATE INDEX sourcepackagerelease_maintainer_idx ON sourcepackagerelease USING btree (maintainer);
8461
19730
CREATE INDEX sourcepackagerelease_sourcepackagename_idx ON sourcepackagerelease USING btree (sourcepackagename);
8463
CREATE INDEX sourcepackagerelease_version_sort ON sourcepackagerelease USING btree (debversion_sort_key(version));
8465
19733
CREATE INDEX sourcepackagereleasefile_libraryfile_idx ON sourcepackagereleasefile USING btree (libraryfile);
8467
19736
CREATE INDEX sourcepackagereleasefile_sourcepackagerelease_idx ON sourcepackagereleasefile USING btree (sourcepackagerelease);
8469
19739
CREATE INDEX specification__completer__idx ON specification USING btree (completer);
8471
19742
CREATE INDEX specification__goal_decider__idx ON specification USING btree (goal_decider);
8473
19745
CREATE INDEX specification__goal_proposer__idx ON specification USING btree (goal_proposer);
8475
19748
CREATE INDEX specification__starter__idx ON specification USING btree (starter);
8477
19751
CREATE INDEX specification_approver_idx ON specification USING btree (approver);
8479
19754
CREATE INDEX specification_assignee_idx ON specification USING btree (assignee);
8481
19757
CREATE INDEX specification_datecreated_idx ON specification USING btree (datecreated);
8483
19760
CREATE INDEX specification_drafter_idx ON specification USING btree (drafter);
8485
CREATE INDEX specification_fti ON specification USING gist (fti ts2.gist_tsvector_ops);
19763
CREATE INDEX specification_fti ON specification USING gist (fti);
8487
19766
CREATE INDEX specification_owner_idx ON specification USING btree (owner);
8489
19769
CREATE INDEX specificationbranch__registrant__idx ON specificationbranch USING btree (registrant);
8491
19772
CREATE INDEX specificationbranch__specification__idx ON specificationbranch USING btree (specification);
8493
19775
CREATE INDEX specificationbug_bug_idx ON specificationbug USING btree (bug);
8495
19778
CREATE INDEX specificationbug_specification_idx ON specificationbug USING btree (specification);
8497
19781
CREATE INDEX specificationdependency_dependency_idx ON specificationdependency USING btree (dependency);
8499
19784
CREATE INDEX specificationdependency_specification_idx ON specificationdependency USING btree (specification);
8501
19787
CREATE INDEX specificationfeedback_requester_idx ON specificationfeedback USING btree (requester);
8503
19790
CREATE INDEX specificationfeedback_reviewer_idx ON specificationfeedback USING btree (reviewer);
8505
19793
CREATE INDEX specificationsubscription_specification_idx ON specificationsubscription USING btree (specification);
8507
19796
CREATE INDEX specificationsubscription_subscriber_idx ON specificationsubscription USING btree (person);
8509
19799
CREATE INDEX sprint__driver__idx ON sprint USING btree (driver);
8511
19802
CREATE INDEX sprint__icon__idx ON sprint USING btree (icon) WHERE (icon IS NOT NULL);
8513
19805
CREATE INDEX sprint__logo__idx ON sprint USING btree (logo) WHERE (logo IS NOT NULL);
8515
19808
CREATE INDEX sprint__mugshot__idx ON sprint USING btree (mugshot) WHERE (mugshot IS NOT NULL);
8517
19811
CREATE INDEX sprint__owner__idx ON sprint USING btree (owner);
8519
19814
CREATE INDEX sprint_datecreated_idx ON sprint USING btree (datecreated);
8521
19817
CREATE INDEX sprintattendance_sprint_idx ON sprintattendance USING btree (sprint);
8523
19820
CREATE INDEX sprintspec_sprint_idx ON sprintspecification USING btree (sprint);
8525
19823
CREATE INDEX sprintspecification__decider__idx ON sprintspecification USING btree (decider);
8527
19826
CREATE INDEX sprintspecification__registrant__idx ON sprintspecification USING btree (registrant);
8529
19829
CREATE INDEX sshkey_person_key ON sshkey USING btree (person);
8531
CREATE INDEX staticdiff__diff__idx ON staticdiff USING btree (diff);
8533
CREATE INDEX structuralsubscription__blueprint_notification_level__idx ON structuralsubscription USING btree (blueprint_notification_level);
8535
CREATE INDEX structuralsubscription__bug_notification_level__idx ON structuralsubscription USING btree (bug_notification_level);
8537
CREATE INDEX structuralsubscription__distribution__sourcepackagename__idx ON structuralsubscription USING btree (distribution, sourcepackagename) WHERE (distribution IS NOT NULL);
8539
CREATE INDEX structuralsubscription__distroseries__idx ON structuralsubscription USING btree (distroseries) WHERE (distroseries IS NOT NULL);
8541
CREATE INDEX structuralsubscription__milestone__idx ON structuralsubscription USING btree (milestone) WHERE (milestone IS NOT NULL);
8543
CREATE INDEX structuralsubscription__product__idx ON structuralsubscription USING btree (product) WHERE (product IS NOT NULL);
8545
CREATE INDEX structuralsubscription__productseries__idx ON structuralsubscription USING btree (productseries) WHERE (productseries IS NOT NULL);
8547
CREATE INDEX structuralsubscription__project__idx ON structuralsubscription USING btree (project) WHERE (project IS NOT NULL);
19832
CREATE UNIQUE INDEX structuralsubscription__distribution__sourcepackagename__subscr ON structuralsubscription USING btree (distribution, sourcepackagename, subscriber) WHERE ((distribution IS NOT NULL) AND (sourcepackagename IS NOT NULL));
19835
CREATE UNIQUE INDEX structuralsubscription__distribution__subscriber__key ON structuralsubscription USING btree (distribution, subscriber) WHERE ((distribution IS NOT NULL) AND (sourcepackagename IS NULL));
19838
CREATE UNIQUE INDEX structuralsubscription__distroseries__subscriber__key ON structuralsubscription USING btree (distroseries, subscriber) WHERE (distroseries IS NOT NULL);
19841
CREATE UNIQUE INDEX structuralsubscription__milestone__subscriber__key ON structuralsubscription USING btree (milestone, subscriber) WHERE (milestone IS NOT NULL);
19844
CREATE UNIQUE INDEX structuralsubscription__product__subscriber__key ON structuralsubscription USING btree (product, subscriber) WHERE (product IS NOT NULL);
19847
CREATE UNIQUE INDEX structuralsubscription__productseries__subscriber__key ON structuralsubscription USING btree (productseries, subscriber) WHERE (productseries IS NOT NULL);
19850
CREATE UNIQUE INDEX structuralsubscription__project__subscriber__key ON structuralsubscription USING btree (project, subscriber) WHERE (project IS NOT NULL);
8549
19853
CREATE INDEX structuralsubscription__subscribed_by__idx ON structuralsubscription USING btree (subscribed_by);
8551
19856
CREATE INDEX structuralsubscription__subscriber__idx ON structuralsubscription USING btree (subscriber);
19859
CREATE INDEX subunitstream__branch_created__idx ON subunitstream USING btree (branch, date_created);
19862
CREATE INDEX subunitstream__stream__idx ON subunitstream USING btree (stream);
19865
CREATE INDEX subunitstream__uploader_created__idx ON subunitstream USING btree (uploader, date_created);
8553
19868
CREATE INDEX teammembership__acknowledged_by__idx ON teammembership USING btree (acknowledged_by) WHERE (acknowledged_by IS NOT NULL);
8555
19871
CREATE INDEX teammembership__last_changed_by__idx ON teammembership USING btree (last_changed_by) WHERE (last_changed_by IS NOT NULL);
8557
19874
CREATE INDEX teammembership__proposed_by__idx ON teammembership USING btree (proposed_by) WHERE (proposed_by IS NOT NULL);
8559
19877
CREATE INDEX teammembership__reviewed_by__idx ON teammembership USING btree (reviewed_by) WHERE (reviewed_by IS NOT NULL);
8561
19880
CREATE INDEX teammembership__team__idx ON teammembership USING btree (team);
8563
19883
CREATE INDEX teamparticipation_person_idx ON teamparticipation USING btree (person);
8565
19885
ALTER TABLE teamparticipation CLUSTER ON teamparticipation_person_idx;
8567
CREATE UNIQUE INDEX tm__potmsgset__language__no_variant__shared__current__key ON translationmessage USING btree (potmsgset, language) WHERE (((is_current IS TRUE) AND (potemplate IS NULL)) AND (variant IS NULL));
8569
CREATE UNIQUE INDEX tm__potmsgset__language__no_variant__shared__imported__key ON translationmessage USING btree (potmsgset, language) WHERE (((is_imported IS TRUE) AND (potemplate IS NULL)) AND (variant IS NULL));
8571
CREATE INDEX tm__potmsgset__language__variant__not_used__idx ON translationmessage USING btree (potmsgset, language, variant) WHERE (NOT ((is_current IS TRUE) AND (is_imported IS TRUE)));
8573
CREATE UNIQUE INDEX tm__potmsgset__language__variant__shared__current__key ON translationmessage USING btree (potmsgset, language, variant) WHERE (((is_current IS TRUE) AND (potemplate IS NULL)) AND (variant IS NOT NULL));
8575
CREATE UNIQUE INDEX tm__potmsgset__language__variant__shared__imported__key ON translationmessage USING btree (potmsgset, language, variant) WHERE (((is_imported IS TRUE) AND (potemplate IS NULL)) AND (variant IS NOT NULL));
8577
CREATE UNIQUE INDEX tm__potmsgset__potemplate__language__no_variant__diverged__curr ON translationmessage USING btree (potmsgset, potemplate, language) WHERE (((is_current IS TRUE) AND (potemplate IS NOT NULL)) AND (variant IS NULL));
8579
CREATE UNIQUE INDEX tm__potmsgset__potemplate__language__no_variant__diverged__impo ON translationmessage USING btree (potmsgset, potemplate, language) WHERE (((is_imported IS TRUE) AND (potemplate IS NOT NULL)) AND (variant IS NULL));
8581
CREATE UNIQUE INDEX tm__potmsgset__potemplate__language__variant__diverged__current ON translationmessage USING btree (potmsgset, potemplate, language, variant) WHERE (((is_current IS TRUE) AND (potemplate IS NOT NULL)) AND (variant IS NOT NULL));
8583
CREATE UNIQUE INDEX tm__potmsgset__potemplate__language__variant__diverged__importe ON translationmessage USING btree (potmsgset, potemplate, language, variant) WHERE (((is_imported IS TRUE) AND (potemplate IS NOT NULL)) AND (variant IS NOT NULL));
19888
CREATE INDEX tm__potmsgset__language__not_used__idx ON translationmessage USING btree (potmsgset, language) WHERE (NOT ((is_current_ubuntu IS TRUE) AND (is_current_upstream IS TRUE)));
19891
CREATE UNIQUE INDEX tm__potmsgset__language__shared__ubuntu__key ON translationmessage USING btree (potmsgset, language) WHERE ((is_current_ubuntu IS TRUE) AND (potemplate IS NULL));
19894
CREATE UNIQUE INDEX tm__potmsgset__language__shared__upstream__key ON translationmessage USING btree (potmsgset, language) WHERE ((is_current_upstream IS TRUE) AND (potemplate IS NULL));
19897
CREATE UNIQUE INDEX tm__potmsgset__template__language__diverged__ubuntu__key ON translationmessage USING btree (potmsgset, potemplate, language) WHERE ((is_current_ubuntu IS TRUE) AND (potemplate IS NOT NULL));
19900
CREATE UNIQUE INDEX tm__potmsgset__template__language__diverged__upstream__key ON translationmessage USING btree (potmsgset, potemplate, language) WHERE ((is_current_upstream IS TRUE) AND (potemplate IS NOT NULL));
8585
19903
CREATE INDEX translationgroup__owner__idx ON translationgroup USING btree (owner);
8587
19906
CREATE INDEX translationimportqueueentry__content__idx ON translationimportqueueentry USING btree (content) WHERE (content IS NOT NULL);
8589
19909
CREATE INDEX translationimportqueueentry__context__path__idx ON translationimportqueueentry USING btree (distroseries, sourcepackagename, productseries, path);
8591
19912
CREATE UNIQUE INDEX translationimportqueueentry__entry_per_importer__unq ON translationimportqueueentry USING btree (importer, path, (COALESCE(potemplate, (-1))), (COALESCE(distroseries, (-1))), (COALESCE(sourcepackagename, (-1))), (COALESCE(productseries, (-1))));
8593
19915
CREATE INDEX translationimportqueueentry__path__idx ON translationimportqueueentry USING btree (path);
8595
19918
CREATE INDEX translationimportqueueentry__pofile__idx ON translationimportqueueentry USING btree (pofile) WHERE (pofile IS NOT NULL);
8597
19921
CREATE INDEX translationimportqueueentry__potemplate__idx ON translationimportqueueentry USING btree (potemplate) WHERE (potemplate IS NOT NULL);
8599
19924
CREATE INDEX translationimportqueueentry__productseries__idx ON translationimportqueueentry USING btree (productseries) WHERE (productseries IS NOT NULL);
8601
19927
CREATE INDEX translationimportqueueentry__sourcepackagename__idx ON translationimportqueueentry USING btree (sourcepackagename) WHERE (sourcepackagename IS NOT NULL);
8603
19930
CREATE UNIQUE INDEX translationimportqueueentry__status__dateimported__id__idx ON translationimportqueueentry USING btree (status, dateimported, id);
8605
CREATE INDEX translationmessage__language__no_variant__submitter__idx ON translationmessage USING btree (language, submitter) WHERE (variant IS NULL);
8607
CREATE INDEX translationmessage__language__variant__submitter__idx ON translationmessage USING btree (language, variant, submitter) WHERE (variant IS NOT NULL);
8609
19933
CREATE INDEX translationmessage__msgstr0__idx ON translationmessage USING btree (msgstr0);
8611
19936
CREATE INDEX translationmessage__msgstr1__idx ON translationmessage USING btree (msgstr1) WHERE (msgstr1 IS NOT NULL);
8613
19939
CREATE INDEX translationmessage__msgstr2__idx ON translationmessage USING btree (msgstr2) WHERE (msgstr2 IS NOT NULL);
8615
19942
CREATE INDEX translationmessage__msgstr3__idx ON translationmessage USING btree (msgstr3) WHERE (msgstr3 IS NOT NULL);
8617
19945
CREATE INDEX translationmessage__msgstr4__idx ON translationmessage USING btree (msgstr4) WHERE (msgstr4 IS NOT NULL);
8619
19948
CREATE INDEX translationmessage__msgstr5__idx ON translationmessage USING btree (msgstr5) WHERE (msgstr5 IS NOT NULL);
8621
CREATE INDEX translationmessage__pofile__idx ON translationmessage USING btree (pofile);
19951
CREATE INDEX translationmessage__potemplate__idx ON translationmessage USING btree (potemplate) WHERE (potemplate IS NOT NULL);
8623
19954
CREATE INDEX translationmessage__potmsgset__idx ON translationmessage USING btree (potmsgset);
8625
19957
CREATE INDEX translationmessage__potmsgset__language__idx ON translationmessage USING btree (potmsgset, language);
8627
19960
CREATE INDEX translationmessage__reviewer__idx ON translationmessage USING btree (reviewer);
8629
19963
CREATE INDEX translationmessage__submitter__idx ON translationmessage USING btree (submitter);
8631
19966
CREATE UNIQUE INDEX translationtemplateitem__potemplate__potmsgset__key ON translationtemplateitem USING btree (potemplate, potmsgset);
8633
19969
CREATE INDEX translationtemplateitem__potemplate__sequence__idx ON translationtemplateitem USING btree (potemplate, sequence);
8635
19972
CREATE UNIQUE INDEX translationtemplateitem__potemplate__sequence__key ON translationtemplateitem USING btree (potemplate, sequence) WHERE (sequence > 0);
8637
19975
CREATE INDEX translationtemplateitem__potmsgset__idx ON translationtemplateitem USING btree (potmsgset);
19978
CREATE INDEX translationtemplatesbuild__branch__idx ON translationtemplatesbuild USING btree (branch);
19981
CREATE INDEX translationtemplatesbuild__build_farm_job__idx ON translationtemplatesbuild USING btree (build_farm_job);
8639
19984
CREATE INDEX translator__translator__idx ON translator USING btree (translator);
8641
19987
CREATE INDEX usertouseremail__recipient__idx ON usertouseremail USING btree (recipient);
8643
19990
CREATE INDEX usertouseremail__sender__date_sent__idx ON usertouseremail USING btree (sender, date_sent);
8645
19993
CREATE INDEX vote__person__idx ON vote USING btree (person);
8647
19996
CREATE INDEX votecast_poll_idx ON votecast USING btree (poll);
8649
CREATE UNIQUE INDEX webserviceban__consumer__ip__key ON webserviceban USING btree (consumer, ip) WHERE ((consumer IS NOT NULL) AND (ip IS NOT NULL));
8651
CREATE UNIQUE INDEX webserviceban__consumer__key ON webserviceban USING btree (consumer) WHERE ((consumer IS NOT NULL) AND (ip IS NULL));
8653
CREATE UNIQUE INDEX webserviceban__ip__key ON webserviceban USING btree (ip) WHERE ((((person IS NULL) AND (consumer IS NULL)) AND (token IS NULL)) AND (ip IS NOT NULL));
8655
CREATE UNIQUE INDEX webserviceban__person__ip__key ON webserviceban USING btree (person, ip) WHERE ((person IS NOT NULL) AND (ip IS NOT NULL));
8657
CREATE UNIQUE INDEX webserviceban__person__key ON webserviceban USING btree (person) WHERE ((person IS NOT NULL) AND (ip IS NULL));
8659
CREATE UNIQUE INDEX webserviceban__token__ip__key ON webserviceban USING btree (token, ip) WHERE ((token IS NOT NULL) AND (ip IS NOT NULL));
8661
CREATE UNIQUE INDEX webserviceban__token__key ON webserviceban USING btree (token) WHERE ((token IS NOT NULL) AND (ip IS NULL));
8663
19999
CREATE INDEX wikiname_person_idx ON wikiname USING btree (person);
8665
CREATE RULE delete_rule AS ON DELETE TO revisionnumber DO INSTEAD DELETE FROM branchrevision WHERE (branchrevision.id = old.id);
8667
CREATE RULE insert_rule AS ON INSERT TO revisionnumber DO INSTEAD INSERT INTO branchrevision (id, sequence, branch, revision) VALUES (new.id, new.sequence, new.branch, new.revision);
8669
CREATE RULE update_rule AS ON UPDATE TO revisionnumber DO INSTEAD UPDATE branchrevision SET id = new.id, sequence = new.sequence, branch = new.branch, revision = new.revision WHERE (branchrevision.id = old.id);
8671
20002
CREATE TRIGGER bug_latest_patch_uploaded_on_delete_t
8672
20003
AFTER DELETE ON bugattachment
8674
20005
EXECUTE PROCEDURE bug_update_latest_patch_uploaded_on_delete();
8676
20008
CREATE TRIGGER bug_latest_patch_uploaded_on_insert_update_t
8677
20009
AFTER INSERT OR UPDATE ON bugattachment
8679
20011
EXECUTE PROCEDURE bug_update_latest_patch_uploaded_on_insert_update();
8681
CREATE TRIGGER lp_mirror_account_del_t
8682
AFTER DELETE ON account
8684
EXECUTE PROCEDURE lp_mirror_del();
8686
CREATE TRIGGER lp_mirror_account_ins_t
8687
AFTER INSERT ON account
8689
EXECUTE PROCEDURE lp_mirror_account_ins();
8691
CREATE TRIGGER lp_mirror_account_upd_t
8692
AFTER UPDATE ON account
8694
EXECUTE PROCEDURE lp_mirror_account_upd();
20014
CREATE TRIGGER bug_maintain_bug_summary_trigger
20015
AFTER DELETE OR UPDATE ON bug
20017
EXECUTE PROCEDURE bug_maintain_bug_summary();
20020
CREATE TRIGGER bug_to_bugtask_heat
20021
AFTER UPDATE ON bug
20023
EXECUTE PROCEDURE bug_update_heat_copy_to_bugtask();
20026
CREATE TRIGGER bugmessage__owner__mirror
20027
AFTER INSERT OR UPDATE ON bugmessage
20029
EXECUTE PROCEDURE bugmessage_copy_owner_from_message();
20032
CREATE TRIGGER bugsubscription_maintain_bug_summary_after_trigger
20033
AFTER INSERT OR DELETE OR UPDATE ON bugsubscription
20035
EXECUTE PROCEDURE bugsubscription_maintain_bug_summary();
20038
CREATE TRIGGER bugsubscription_maintain_bug_summary_before_trigger
20039
BEFORE INSERT OR DELETE OR UPDATE ON bugsubscription
20041
EXECUTE PROCEDURE bugsubscription_maintain_bug_summary();
20044
CREATE TRIGGER bugtag_maintain_bug_summary_after_trigger
20045
AFTER INSERT OR DELETE OR UPDATE ON bugtag
20047
EXECUTE PROCEDURE bugtag_maintain_bug_summary();
20050
CREATE TRIGGER bugtag_maintain_bug_summary_before_trigger
20051
BEFORE INSERT OR DELETE OR UPDATE ON bugtag
20053
EXECUTE PROCEDURE bugtag_maintain_bug_summary();
20056
CREATE TRIGGER bugtask_maintain_bug_summary_after_trigger
20057
AFTER INSERT OR DELETE OR UPDATE ON bugtask
20059
EXECUTE PROCEDURE bugtask_maintain_bug_summary();
20062
CREATE TRIGGER bugtask_maintain_bug_summary_before_trigger
20063
BEFORE INSERT OR DELETE OR UPDATE ON bugtask
20065
EXECUTE PROCEDURE bugtask_maintain_bug_summary();
20068
CREATE TRIGGER lp_mirror_openididentifier_del_t
20069
AFTER DELETE ON openididentifier
20071
EXECUTE PROCEDURE lp_mirror_openididentifier_del();
20074
CREATE TRIGGER lp_mirror_openididentifier_ins_t
20075
AFTER INSERT ON openididentifier
20077
EXECUTE PROCEDURE lp_mirror_openididentifier_ins();
20080
CREATE TRIGGER lp_mirror_openididentifier_upd_t
20081
AFTER UPDATE ON openididentifier
20083
EXECUTE PROCEDURE lp_mirror_openididentifier_upd();
8696
20086
CREATE TRIGGER lp_mirror_person_del_t
8697
20087
AFTER DELETE ON person
8699
20089
EXECUTE PROCEDURE lp_mirror_del();
8701
20092
CREATE TRIGGER lp_mirror_person_ins_t
8702
20093
AFTER INSERT ON person
8704
20095
EXECUTE PROCEDURE lp_mirror_person_ins();
8706
20098
CREATE TRIGGER lp_mirror_person_upd_t
8707
20099
AFTER UPDATE ON person
8709
20101
EXECUTE PROCEDURE lp_mirror_person_upd();
8711
20104
CREATE TRIGGER lp_mirror_personlocation_del_t
8712
20105
AFTER DELETE ON teamparticipation
8714
20107
EXECUTE PROCEDURE lp_mirror_del();
8716
20110
CREATE TRIGGER lp_mirror_personlocation_ins_t
8717
20111
AFTER INSERT ON personlocation
8719
20113
EXECUTE PROCEDURE lp_mirror_personlocation_ins();
8721
20116
CREATE TRIGGER lp_mirror_personlocation_upd_t
8722
20117
AFTER UPDATE ON personlocation
8724
20119
EXECUTE PROCEDURE lp_mirror_personlocation_upd();
8726
20122
CREATE TRIGGER lp_mirror_teamparticipation_del_t
8727
20123
AFTER DELETE ON teamparticipation
8729
20125
EXECUTE PROCEDURE lp_mirror_del();
8731
20128
CREATE TRIGGER lp_mirror_teamparticipation_ins_t
8732
20129
AFTER INSERT ON teamparticipation
8734
20131
EXECUTE PROCEDURE lp_mirror_teamparticipation_ins();
8736
20134
CREATE TRIGGER lp_mirror_teamparticipation_upd_t
8737
20135
AFTER UPDATE ON teamparticipation
8739
20137
EXECUTE PROCEDURE lp_mirror_teamparticipation_upd();
20140
CREATE TRIGGER maintain_branch_transitive_privacy_t
20141
AFTER INSERT OR UPDATE ON branch
20143
EXECUTE PROCEDURE maintain_transitively_private();
20146
CREATE TRIGGER message__owner__mirror
20147
AFTER UPDATE ON message
20149
EXECUTE PROCEDURE message_copy_owner_to_bugmessage();
20152
CREATE TRIGGER message__owner__mirror__questionmessage
20153
AFTER UPDATE ON message
20155
EXECUTE PROCEDURE message_copy_owner_to_questionmessage();
8741
20158
CREATE TRIGGER mv_branch_distribution_update_t
8742
20159
AFTER UPDATE ON distribution
8744
20161
EXECUTE PROCEDURE mv_branch_distribution_update();
8746
20164
CREATE TRIGGER mv_branch_distroseries_update_t
8747
20165
AFTER UPDATE ON distroseries
8749
20167
EXECUTE PROCEDURE mv_branch_distroseries_update();
8751
20170
CREATE TRIGGER mv_branch_person_update_t
8752
20171
AFTER UPDATE ON person
8754
20173
EXECUTE PROCEDURE mv_branch_person_update();
8756
20176
CREATE TRIGGER mv_branch_product_update_t
8757
20177
AFTER UPDATE ON product
8759
20179
EXECUTE PROCEDURE mv_branch_product_update();
8761
20182
CREATE TRIGGER mv_pillarname_distribution_t
8762
20183
AFTER INSERT OR UPDATE ON distribution
8764
20185
EXECUTE PROCEDURE mv_pillarname_distribution();
8766
20188
CREATE TRIGGER mv_pillarname_product_t
8767
20189
AFTER INSERT OR UPDATE ON product
8769
20191
EXECUTE PROCEDURE mv_pillarname_product();
8771
20194
CREATE TRIGGER mv_pillarname_project_t
8772
20195
AFTER INSERT OR UPDATE ON project
8774
20197
EXECUTE PROCEDURE mv_pillarname_project();
8776
20200
CREATE TRIGGER mv_pofiletranslator_translationmessage
8777
20201
AFTER INSERT OR DELETE OR UPDATE ON translationmessage
8779
20203
EXECUTE PROCEDURE mv_pofiletranslator_translationmessage();
8781
20206
CREATE TRIGGER packageset_deleted_trig
8782
20207
BEFORE DELETE ON packageset
8784
20209
EXECUTE PROCEDURE packageset_deleted_trig();
8786
20212
CREATE TRIGGER packageset_inserted_trig
8787
20213
AFTER INSERT ON packageset
8789
20215
EXECUTE PROCEDURE packageset_inserted_trig();
8791
20218
CREATE TRIGGER packagesetinclusion_deleted_trig
8792
20219
BEFORE DELETE ON packagesetinclusion
8794
20221
EXECUTE PROCEDURE packagesetinclusion_deleted_trig();
8796
20224
CREATE TRIGGER packagesetinclusion_inserted_trig
8797
20225
AFTER INSERT ON packagesetinclusion
8799
20227
EXECUTE PROCEDURE packagesetinclusion_inserted_trig();
20230
CREATE TRIGGER questionmessage__owner__mirror
20231
AFTER INSERT OR UPDATE ON questionmessage
20233
EXECUTE PROCEDURE questionmessage_copy_owner_from_message();
8801
20236
CREATE TRIGGER set_bug_message_count_t
8802
20237
AFTER INSERT OR DELETE OR UPDATE ON bugmessage
8804
20239
EXECUTE PROCEDURE set_bug_message_count();
8806
20242
CREATE TRIGGER set_bug_number_of_duplicates_t
8807
20243
AFTER INSERT OR DELETE OR UPDATE ON bug
8809
20245
EXECUTE PROCEDURE set_bug_number_of_duplicates();
8811
20248
CREATE TRIGGER set_bug_users_affected_count_t
8812
20249
AFTER INSERT OR DELETE OR UPDATE ON bugaffectsperson
8814
20251
EXECUTE PROCEDURE set_bug_users_affected_count();
8816
20254
CREATE TRIGGER set_bugtask_date_milestone_set_t
8817
20255
AFTER INSERT OR UPDATE ON bugtask
8819
20257
EXECUTE PROCEDURE set_bugtask_date_milestone_set();
8821
20260
CREATE TRIGGER set_date_last_message_t
8822
20261
AFTER INSERT OR DELETE OR UPDATE ON bugmessage
8824
20263
EXECUTE PROCEDURE set_bug_date_last_message();
8826
20266
CREATE TRIGGER set_date_status_set_t
8827
20267
BEFORE UPDATE ON account
8829
20269
EXECUTE PROCEDURE set_date_status_set();
8831
CREATE TRIGGER set_normalized_address
8832
BEFORE INSERT OR UPDATE ON shippingrequest
8834
EXECUTE PROCEDURE set_shipit_normalized_address();
8836
CREATE TRIGGER tsvectorupdate
8837
BEFORE INSERT OR UPDATE ON bugtask
8839
EXECUTE PROCEDURE ts2.ftiupdate('targetnamecache', 'b', 'statusexplanation', 'c');
8841
20272
CREATE TRIGGER tsvectorupdate
8842
20273
BEFORE INSERT OR UPDATE ON binarypackagerelease
8844
20275
EXECUTE PROCEDURE ts2.ftiupdate('summary', 'b', 'description', 'c');
8846
20278
CREATE TRIGGER tsvectorupdate
8847
20279
BEFORE INSERT OR UPDATE ON cve
8849
20281
EXECUTE PROCEDURE ts2.ftiupdate('sequence', 'a', 'description', 'b');
8851
20284
CREATE TRIGGER tsvectorupdate
8852
20285
BEFORE INSERT OR UPDATE ON distroseriespackagecache
8854
20287
EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'summaries', 'b', 'descriptions', 'c');
8856
20290
CREATE TRIGGER tsvectorupdate
8857
20291
BEFORE INSERT OR UPDATE ON message
8859
20293
EXECUTE PROCEDURE ts2.ftiupdate('subject', 'b');
8861
20296
CREATE TRIGGER tsvectorupdate
8862
20297
BEFORE INSERT OR UPDATE ON messagechunk
8864
20299
EXECUTE PROCEDURE ts2.ftiupdate('content', 'c');
8866
20302
CREATE TRIGGER tsvectorupdate
8867
20303
BEFORE INSERT OR UPDATE ON product
8869
20305
EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'displayname', 'a', 'title', 'b', 'summary', 'c', 'description', 'd');
8871
20308
CREATE TRIGGER tsvectorupdate
8872
20309
BEFORE INSERT OR UPDATE ON project
8874
20311
EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'displayname', 'a', 'title', 'b', 'summary', 'c', 'description', 'd');
8876
CREATE TRIGGER tsvectorupdate
8877
BEFORE INSERT OR UPDATE ON shippingrequest
8879
EXECUTE PROCEDURE ts2.ftiupdate('recipientdisplayname', 'a');
8881
20314
CREATE TRIGGER tsvectorupdate
8882
20315
BEFORE INSERT OR UPDATE ON question
8884
20317
EXECUTE PROCEDURE ts2.ftiupdate('title', 'a', 'description', 'b', 'whiteboard', 'b');
8886
20320
CREATE TRIGGER tsvectorupdate
8887
20321
BEFORE INSERT OR UPDATE ON bug
8889
20323
EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'title', 'b', 'description', 'd');
8891
20326
CREATE TRIGGER tsvectorupdate
8892
20327
BEFORE INSERT OR UPDATE ON person
8894
20329
EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'displayname', 'a');
8896
20332
CREATE TRIGGER tsvectorupdate
8897
20333
BEFORE INSERT OR UPDATE ON specification
8899
20335
EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'title', 'a', 'summary', 'b', 'whiteboard', 'd');
8901
20338
CREATE TRIGGER tsvectorupdate
8902
20339
BEFORE INSERT OR UPDATE ON distribution
8904
20341
EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'displayname', 'a', 'title', 'b', 'summary', 'c', 'description', 'd');
8906
20344
CREATE TRIGGER tsvectorupdate
8907
20345
BEFORE INSERT OR UPDATE ON distributionsourcepackagecache
8909
20347
EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'binpkgnames', 'b', 'binpkgsummaries', 'c', 'binpkgdescriptions', 'd', 'changelog', 'd');
8911
20350
CREATE TRIGGER tsvectorupdate
8912
20351
BEFORE INSERT OR UPDATE ON productreleasefile
8914
20353
EXECUTE PROCEDURE ts2.ftiupdate('description', 'd');
8916
20356
CREATE TRIGGER tsvectorupdate
8917
20357
BEFORE INSERT OR UPDATE ON faq
8919
20359
EXECUTE PROCEDURE ts2.ftiupdate('title', 'a', 'tags', 'b', 'content', 'd');
8921
20362
CREATE TRIGGER tsvectorupdate
8922
20363
BEFORE INSERT OR UPDATE ON archive
8924
20365
EXECUTE PROCEDURE ts2.ftiupdate('description', 'a', 'package_description_cache', 'b');
20368
CREATE TRIGGER tsvectorupdate
20369
BEFORE INSERT OR UPDATE ON bugtask
20371
EXECUTE PROCEDURE ts2.ftiupdate('targetnamecache', 'b');
8926
20374
CREATE TRIGGER update_branch_name_cache_t
8927
20375
BEFORE INSERT OR UPDATE ON branch
8929
20377
EXECUTE PROCEDURE update_branch_name_cache();
8931
20380
CREATE TRIGGER you_are_your_own_member
8932
20381
AFTER INSERT ON person
8934
20383
EXECUTE PROCEDURE you_are_your_own_member();
8936
20386
ALTER TABLE ONLY processor
8937
20387
ADD CONSTRAINT "$1" FOREIGN KEY (family) REFERENCES processorfamily(id);
8939
20390
ALTER TABLE ONLY builder
8940
20391
ADD CONSTRAINT "$1" FOREIGN KEY (processor) REFERENCES processor(id);
8942
20394
ALTER TABLE ONLY distribution
8943
20395
ADD CONSTRAINT "$1" FOREIGN KEY (owner) REFERENCES person(id);
8945
20398
ALTER TABLE ONLY libraryfilealias
8946
20399
ADD CONSTRAINT "$1" FOREIGN KEY (content) REFERENCES libraryfilecontent(id);
8948
20402
ALTER TABLE ONLY productreleasefile
8949
20403
ADD CONSTRAINT "$1" FOREIGN KEY (productrelease) REFERENCES productrelease(id);
8951
20406
ALTER TABLE ONLY spokenin
8952
20407
ADD CONSTRAINT "$1" FOREIGN KEY (language) REFERENCES language(id);
8954
ALTER TABLE ONLY pocomment
8955
ADD CONSTRAINT "$1" FOREIGN KEY (potemplate) REFERENCES potemplate(id);
8957
ALTER TABLE ONLY posubscription
8958
ADD CONSTRAINT "$1" FOREIGN KEY (person) REFERENCES person(id);
8960
20410
ALTER TABLE ONLY bugsubscription
8961
20411
ADD CONSTRAINT "$1" FOREIGN KEY (person) REFERENCES person(id);
8963
20414
ALTER TABLE ONLY bugactivity
8964
20415
ADD CONSTRAINT "$1" FOREIGN KEY (bug) REFERENCES bug(id);
8966
20418
ALTER TABLE ONLY sshkey
8967
20419
ADD CONSTRAINT "$1" FOREIGN KEY (person) REFERENCES person(id);
8969
ALTER TABLE ONLY pushmirroraccess
8970
ADD CONSTRAINT "$1" FOREIGN KEY (person) REFERENCES person(id);
8972
20422
ALTER TABLE ONLY polloption
8973
20423
ADD CONSTRAINT "$1" FOREIGN KEY (poll) REFERENCES poll(id);
8975
20426
ALTER TABLE ONLY product
8976
20427
ADD CONSTRAINT "$1" FOREIGN KEY (bug_supervisor) REFERENCES person(id);
8978
ALTER TABLE ONLY shipitreport
8979
ADD CONSTRAINT "$1" FOREIGN KEY (csvfile) REFERENCES libraryfilealias(id);
8981
20430
ALTER TABLE ONLY country
8982
20431
ADD CONSTRAINT "$1" FOREIGN KEY (continent) REFERENCES continent(id);
8984
20434
ALTER TABLE ONLY sourcepackagereleasefile
8985
20435
ADD CONSTRAINT "$1" FOREIGN KEY (sourcepackagerelease) REFERENCES sourcepackagerelease(id) ON DELETE CASCADE;
8987
20438
ALTER TABLE ONLY builder
8988
20439
ADD CONSTRAINT "$2" FOREIGN KEY (owner) REFERENCES person(id);
8990
20442
ALTER TABLE ONLY productreleasefile
8991
20443
ADD CONSTRAINT "$2" FOREIGN KEY (libraryfile) REFERENCES libraryfilealias(id);
8993
20446
ALTER TABLE ONLY sourcepackagereleasefile
8994
20447
ADD CONSTRAINT "$2" FOREIGN KEY (libraryfile) REFERENCES libraryfilealias(id);
8996
20450
ALTER TABLE ONLY spokenin
8997
20451
ADD CONSTRAINT "$2" FOREIGN KEY (country) REFERENCES country(id);
8999
ALTER TABLE ONLY pocomment
9000
ADD CONSTRAINT "$2" FOREIGN KEY (pomsgid) REFERENCES pomsgid(id);
9002
ALTER TABLE ONLY posubscription
9003
ADD CONSTRAINT "$2" FOREIGN KEY (potemplate) REFERENCES potemplate(id);
9005
20454
ALTER TABLE ONLY bugsubscription
9006
20455
ADD CONSTRAINT "$2" FOREIGN KEY (bug) REFERENCES bug(id);
9008
20458
ALTER TABLE ONLY buildqueue
9009
20459
ADD CONSTRAINT "$2" FOREIGN KEY (builder) REFERENCES builder(id);
9011
20462
ALTER TABLE ONLY distribution
9012
20463
ADD CONSTRAINT "$2" FOREIGN KEY (members) REFERENCES person(id);
9014
ALTER TABLE ONLY pocomment
9015
ADD CONSTRAINT "$3" FOREIGN KEY (language) REFERENCES language(id);
9017
ALTER TABLE ONLY posubscription
9018
ADD CONSTRAINT "$3" FOREIGN KEY (language) REFERENCES language(id);
9020
20466
ALTER TABLE ONLY distribution
9021
20467
ADD CONSTRAINT "$3" FOREIGN KEY (bug_supervisor) REFERENCES person(id);
9023
20470
ALTER TABLE ONLY pofile
9024
20471
ADD CONSTRAINT "$3" FOREIGN KEY (from_sourcepackagename) REFERENCES sourcepackagename(id);
9026
ALTER TABLE ONLY pocomment
9027
ADD CONSTRAINT "$4" FOREIGN KEY (potranslation) REFERENCES potranslation(id);
9029
ALTER TABLE ONLY pocomment
9030
ADD CONSTRAINT "$5" FOREIGN KEY (person) REFERENCES person(id);
20474
ALTER TABLE ONLY accesspolicy
20475
ADD CONSTRAINT accesspolicy_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
20478
ALTER TABLE ONLY accesspolicy
20479
ADD CONSTRAINT accesspolicy_product_fkey FOREIGN KEY (product) REFERENCES product(id);
20482
ALTER TABLE ONLY accesspolicyartifact
20483
ADD CONSTRAINT accesspolicyartifact_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
20486
ALTER TABLE ONLY accesspolicyartifact
20487
ADD CONSTRAINT accesspolicyartifact_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
20490
ALTER TABLE ONLY accesspolicyartifact
20491
ADD CONSTRAINT accesspolicyartifact_policy_fkey FOREIGN KEY (policy) REFERENCES accesspolicy(id);
20494
ALTER TABLE ONLY accesspolicygrant
20495
ADD CONSTRAINT accesspolicygrant_artifact_fkey FOREIGN KEY (artifact) REFERENCES accesspolicyartifact(id);
20498
ALTER TABLE ONLY accesspolicygrant
20499
ADD CONSTRAINT accesspolicygrant_grantee_fkey FOREIGN KEY (grantee) REFERENCES person(id);
20502
ALTER TABLE ONLY accesspolicygrant
20503
ADD CONSTRAINT accesspolicygrant_grantor_fkey FOREIGN KEY (grantor) REFERENCES person(id);
20506
ALTER TABLE ONLY accesspolicygrant
20507
ADD CONSTRAINT accesspolicygrant_policy_fkey FOREIGN KEY (policy) REFERENCES accesspolicy(id);
9032
20510
ALTER TABLE ONLY accountpassword
9033
20511
ADD CONSTRAINT accountpassword_account_fkey FOREIGN KEY (account) REFERENCES account(id) ON DELETE CASCADE;
9035
20514
ALTER TABLE ONLY karma
9036
20515
ADD CONSTRAINT action_fkey FOREIGN KEY (action) REFERENCES karmaaction(id);
9038
20518
ALTER TABLE ONLY announcement
9039
20519
ADD CONSTRAINT announcement_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
9041
20522
ALTER TABLE ONLY announcement
9042
20523
ADD CONSTRAINT announcement_product_fkey FOREIGN KEY (product) REFERENCES product(id);
9044
20526
ALTER TABLE ONLY announcement
9045
20527
ADD CONSTRAINT announcement_project_fkey FOREIGN KEY (project) REFERENCES project(id);
9047
20530
ALTER TABLE ONLY announcement
9048
20531
ADD CONSTRAINT announcement_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
9050
20534
ALTER TABLE ONLY answercontact
9051
20535
ADD CONSTRAINT answercontact__distribution__fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
9053
20538
ALTER TABLE ONLY answercontact
9054
20539
ADD CONSTRAINT answercontact__person__fkey FOREIGN KEY (person) REFERENCES person(id);
9056
20542
ALTER TABLE ONLY answercontact
9057
20543
ADD CONSTRAINT answercontact__product__fkey FOREIGN KEY (product) REFERENCES product(id);
9059
20546
ALTER TABLE ONLY answercontact
9060
20547
ADD CONSTRAINT answercontact__sourcepackagename__fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
9062
20550
ALTER TABLE ONLY apportjob
9063
20551
ADD CONSTRAINT apportjob_blob_fkey FOREIGN KEY (blob) REFERENCES temporaryblobstorage(id);
9065
20554
ALTER TABLE ONLY apportjob
9066
20555
ADD CONSTRAINT apportjob_job_fkey FOREIGN KEY (job) REFERENCES job(id);
9068
20558
ALTER TABLE ONLY archive
9069
20559
ADD CONSTRAINT archive__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
9071
20562
ALTER TABLE ONLY archive
9072
20563
ADD CONSTRAINT archive__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
9074
20566
ALTER TABLE ONLY archive
9075
20567
ADD CONSTRAINT archive_signing_key_fkey FOREIGN KEY (signing_key) REFERENCES gpgkey(id);
9077
20570
ALTER TABLE ONLY archivearch
9078
20571
ADD CONSTRAINT archivearch__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
9080
20574
ALTER TABLE ONLY archivearch
9081
20575
ADD CONSTRAINT archivearch__processorfamily__fk FOREIGN KEY (processorfamily) REFERENCES processorfamily(id);
9083
20578
ALTER TABLE ONLY archiveauthtoken
9084
20579
ADD CONSTRAINT archiveauthtoken__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
9086
20582
ALTER TABLE ONLY archiveauthtoken
9087
20583
ADD CONSTRAINT archiveauthtoken_person_fkey FOREIGN KEY (person) REFERENCES person(id);
9089
20586
ALTER TABLE ONLY archivedependency
9090
20587
ADD CONSTRAINT archivedependency__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
9092
20590
ALTER TABLE ONLY archivedependency
9093
20591
ADD CONSTRAINT archivedependency__dependency__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
9095
20594
ALTER TABLE ONLY archivedependency
9096
20595
ADD CONSTRAINT archivedependency_component_fkey FOREIGN KEY (component) REFERENCES component(id);
9098
20598
ALTER TABLE ONLY archivejob
9099
20599
ADD CONSTRAINT archivejob__archive__fk FOREIGN KEY (archive) REFERENCES archive(id);
9101
20602
ALTER TABLE ONLY archivejob
9102
20603
ADD CONSTRAINT archivejob__job__fk FOREIGN KEY (job) REFERENCES job(id) ON DELETE CASCADE;
9104
20606
ALTER TABLE ONLY archivepermission
9105
20607
ADD CONSTRAINT archivepermission__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
9107
20610
ALTER TABLE ONLY archivepermission
9108
20611
ADD CONSTRAINT archivepermission__component__fk FOREIGN KEY (component) REFERENCES component(id);
9110
20614
ALTER TABLE ONLY archivepermission
9111
20615
ADD CONSTRAINT archivepermission__packageset__fk FOREIGN KEY (packageset) REFERENCES packageset(id);
9113
20618
ALTER TABLE ONLY archivepermission
9114
20619
ADD CONSTRAINT archivepermission__person__fk FOREIGN KEY (person) REFERENCES person(id);
9116
20622
ALTER TABLE ONLY archivepermission
9117
20623
ADD CONSTRAINT archivepermission__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
9119
20626
ALTER TABLE ONLY archivesubscriber
9120
20627
ADD CONSTRAINT archivesubscriber__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
9122
20630
ALTER TABLE ONLY archivesubscriber
9123
20631
ADD CONSTRAINT archivesubscriber_cancelled_by_fkey FOREIGN KEY (cancelled_by) REFERENCES person(id);
9125
20634
ALTER TABLE ONLY archivesubscriber
9126
20635
ADD CONSTRAINT archivesubscriber_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
9128
20638
ALTER TABLE ONLY archivesubscriber
9129
20639
ADD CONSTRAINT archivesubscriber_subscriber_fkey FOREIGN KEY (subscriber) REFERENCES person(id);
9131
ALTER TABLE ONLY authtoken
9132
ADD CONSTRAINT authtoken__requester__fk FOREIGN KEY (requester) REFERENCES account(id);
9134
20642
ALTER TABLE ONLY binarypackagebuild
9135
20643
ADD CONSTRAINT binarypackagebuild__distro_arch_series__fk FOREIGN KEY (distro_arch_series) REFERENCES distroarchseries(id);
9137
20646
ALTER TABLE ONLY binarypackagebuild
9138
20647
ADD CONSTRAINT binarypackagebuild__package_build__fk FOREIGN KEY (package_build) REFERENCES packagebuild(id);
9140
20650
ALTER TABLE ONLY binarypackagebuild
9141
20651
ADD CONSTRAINT binarypackagebuild__source_package_release__fk FOREIGN KEY (source_package_release) REFERENCES sourcepackagerelease(id);
9143
20654
ALTER TABLE ONLY binarypackagefile
9144
20655
ADD CONSTRAINT binarypackagefile_binarypackagerelease_fk FOREIGN KEY (binarypackagerelease) REFERENCES binarypackagerelease(id) ON DELETE CASCADE;
9146
20658
ALTER TABLE ONLY binarypackagefile
9147
20659
ADD CONSTRAINT binarypackagefile_libraryfile_fk FOREIGN KEY (libraryfile) REFERENCES libraryfilealias(id);
20662
ALTER TABLE ONLY binarypackagepublishinghistory
20663
ADD CONSTRAINT binarypackagepublishinghistory_binarypackagename_fkey FOREIGN KEY (binarypackagename) REFERENCES binarypackagename(id);
9149
20666
ALTER TABLE ONLY binarypackagepublishinghistory
9150
20667
ADD CONSTRAINT binarypackagepublishinghistory_supersededby_fk FOREIGN KEY (supersededby) REFERENCES binarypackagebuild(id);
9152
20670
ALTER TABLE ONLY binarypackagerelease
9153
20671
ADD CONSTRAINT binarypackagerelease_binarypackagename_fk FOREIGN KEY (binarypackagename) REFERENCES binarypackagename(id);
9155
20674
ALTER TABLE ONLY binarypackagerelease
9156
20675
ADD CONSTRAINT binarypackagerelease_build_fk FOREIGN KEY (build) REFERENCES binarypackagebuild(id) ON DELETE CASCADE;
9158
20678
ALTER TABLE ONLY binarypackagerelease
9159
20679
ADD CONSTRAINT binarypackagerelease_component_fk FOREIGN KEY (component) REFERENCES component(id);
9161
20682
ALTER TABLE ONLY binarypackagerelease
9162
20683
ADD CONSTRAINT binarypackagerelease_debug_package_fkey FOREIGN KEY (debug_package) REFERENCES binarypackagerelease(id);
9164
20686
ALTER TABLE ONLY binarypackagerelease
9165
20687
ADD CONSTRAINT binarypackagerelease_section_fk FOREIGN KEY (section) REFERENCES section(id);
20690
ALTER TABLE ONLY binarypackagereleasecontents
20691
ADD CONSTRAINT binarypackagereleasecontents_binarypackagepath_fkey FOREIGN KEY (binarypackagepath) REFERENCES binarypackagepath(id);
20694
ALTER TABLE ONLY binarypackagereleasecontents
20695
ADD CONSTRAINT binarypackagereleasecontents_binarypackagerelease_fkey FOREIGN KEY (binarypackagerelease) REFERENCES binarypackagerelease(id);
9167
20698
ALTER TABLE ONLY binarypackagereleasedownloadcount
9168
20699
ADD CONSTRAINT binarypackagereleasedownloadcount_archive_fkey FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
9170
20702
ALTER TABLE ONLY binarypackagereleasedownloadcount
9171
20703
ADD CONSTRAINT binarypackagereleasedownloadcount_binary_package_release_fkey FOREIGN KEY (binary_package_release) REFERENCES binarypackagerelease(id);
9173
20706
ALTER TABLE ONLY binarypackagereleasedownloadcount
9174
20707
ADD CONSTRAINT binarypackagereleasedownloadcount_country_fkey FOREIGN KEY (country) REFERENCES country(id);
9176
ALTER TABLE ONLY bounty
9177
ADD CONSTRAINT bounty_claimant_fk FOREIGN KEY (claimant) REFERENCES person(id);
9179
ALTER TABLE ONLY bounty
9180
ADD CONSTRAINT bounty_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
9182
ALTER TABLE ONLY bounty
9183
ADD CONSTRAINT bounty_reviewer_fk FOREIGN KEY (reviewer) REFERENCES person(id);
9185
ALTER TABLE ONLY bountymessage
9186
ADD CONSTRAINT bountymessage_bounty_fk FOREIGN KEY (bounty) REFERENCES bounty(id);
9188
ALTER TABLE ONLY bountymessage
9189
ADD CONSTRAINT bountymessage_message_fk FOREIGN KEY (message) REFERENCES message(id);
9191
ALTER TABLE ONLY bountysubscription
9192
ADD CONSTRAINT bountysubscription_bounty_fk FOREIGN KEY (bounty) REFERENCES bounty(id);
9194
ALTER TABLE ONLY bountysubscription
9195
ADD CONSTRAINT bountysubscription_person_fk FOREIGN KEY (person) REFERENCES person(id);
20710
ALTER TABLE ONLY branch
20711
ADD CONSTRAINT branch_access_policy_fkey FOREIGN KEY (access_policy) REFERENCES accesspolicy(id);
9197
20714
ALTER TABLE ONLY branch
9198
20715
ADD CONSTRAINT branch_author_fk FOREIGN KEY (author) REFERENCES person(id);
9200
20718
ALTER TABLE ONLY branch
9201
20719
ADD CONSTRAINT branch_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id);
20722
ALTER TABLE ONLY incrementaldiff
20723
ADD CONSTRAINT branch_merge_proposal_fk FOREIGN KEY (branch_merge_proposal) REFERENCES branchmergeproposal(id) ON DELETE CASCADE;
9203
20726
ALTER TABLE ONLY branch
9204
ADD CONSTRAINT branch_merge_robot_fkey FOREIGN KEY (merge_robot) REFERENCES branchmergerobot(id);
20727
ADD CONSTRAINT branch_merge_queue_fkey FOREIGN KEY (merge_queue) REFERENCES branchmergequeue(id);
9206
20730
ALTER TABLE ONLY branch
9207
20731
ADD CONSTRAINT branch_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
9209
20734
ALTER TABLE ONLY branch
9210
20735
ADD CONSTRAINT branch_product_fk FOREIGN KEY (product) REFERENCES product(id);
9212
20738
ALTER TABLE ONLY branch
9213
20739
ADD CONSTRAINT branch_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
9215
20742
ALTER TABLE ONLY branch
9216
20743
ADD CONSTRAINT branch_reviewer_fkey FOREIGN KEY (reviewer) REFERENCES person(id);
9218
20746
ALTER TABLE ONLY branch
9219
20747
ADD CONSTRAINT branch_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
9221
20750
ALTER TABLE ONLY branch
9222
20751
ADD CONSTRAINT branch_stacked_on_fkey FOREIGN KEY (stacked_on) REFERENCES branch(id);
9224
20754
ALTER TABLE ONLY branchjob
9225
20755
ADD CONSTRAINT branchjob_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
9227
20758
ALTER TABLE ONLY branchjob
9228
20759
ADD CONSTRAINT branchjob_job_fkey FOREIGN KEY (job) REFERENCES job(id) ON DELETE CASCADE;
9230
20762
ALTER TABLE ONLY branchmergeproposal
9231
20763
ADD CONSTRAINT branchmergeproposal_dependent_branch_fkey FOREIGN KEY (dependent_branch) REFERENCES branch(id);
9233
20766
ALTER TABLE ONLY branchmergeproposal
9234
20767
ADD CONSTRAINT branchmergeproposal_merge_diff_fkey FOREIGN KEY (merge_diff) REFERENCES previewdiff(id);
9236
20770
ALTER TABLE ONLY branchmergeproposal
9237
20771
ADD CONSTRAINT branchmergeproposal_merge_log_file_fkey FOREIGN KEY (merge_log_file) REFERENCES libraryfilealias(id);
9239
20774
ALTER TABLE ONLY branchmergeproposal
9240
20775
ADD CONSTRAINT branchmergeproposal_merge_reporter_fkey FOREIGN KEY (merge_reporter) REFERENCES person(id);
9242
20778
ALTER TABLE ONLY branchmergeproposal
9243
20779
ADD CONSTRAINT branchmergeproposal_merger_fkey FOREIGN KEY (merger) REFERENCES person(id);
9245
20782
ALTER TABLE ONLY branchmergeproposal
9246
20783
ADD CONSTRAINT branchmergeproposal_queuer_fkey FOREIGN KEY (queuer) REFERENCES person(id);
9248
20786
ALTER TABLE ONLY branchmergeproposal
9249
20787
ADD CONSTRAINT branchmergeproposal_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
9251
ALTER TABLE ONLY branchmergeproposal
9252
ADD CONSTRAINT branchmergeproposal_review_diff_fkey FOREIGN KEY (review_diff) REFERENCES staticdiff(id);
9254
20790
ALTER TABLE ONLY branchmergeproposal
9255
20791
ADD CONSTRAINT branchmergeproposal_reviewer_fkey FOREIGN KEY (reviewer) REFERENCES person(id);
9257
20794
ALTER TABLE ONLY branchmergeproposal
9258
20795
ADD CONSTRAINT branchmergeproposal_source_branch_fkey FOREIGN KEY (source_branch) REFERENCES branch(id);
9260
20798
ALTER TABLE ONLY branchmergeproposal
9261
20799
ADD CONSTRAINT branchmergeproposal_superseded_by_fkey FOREIGN KEY (superseded_by) REFERENCES branchmergeproposal(id);
9263
20802
ALTER TABLE ONLY branchmergeproposal
9264
20803
ADD CONSTRAINT branchmergeproposal_target_branch_fkey FOREIGN KEY (target_branch) REFERENCES branch(id);
9266
20806
ALTER TABLE ONLY branchmergeproposaljob
9267
20807
ADD CONSTRAINT branchmergeproposaljob_branch_merge_proposal_fkey FOREIGN KEY (branch_merge_proposal) REFERENCES branchmergeproposal(id);
9269
20810
ALTER TABLE ONLY branchmergeproposaljob
9270
20811
ADD CONSTRAINT branchmergeproposaljob_job_fkey FOREIGN KEY (job) REFERENCES job(id) ON DELETE CASCADE;
9272
ALTER TABLE ONLY branchmergerobot
9273
ADD CONSTRAINT branchmergerobot_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
9275
ALTER TABLE ONLY branchmergerobot
9276
ADD CONSTRAINT branchmergerobot_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
20814
ALTER TABLE ONLY branchmergequeue
20815
ADD CONSTRAINT branchmergequeue_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
20818
ALTER TABLE ONLY branchmergequeue
20819
ADD CONSTRAINT branchmergequeue_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
9278
20822
ALTER TABLE ONLY branchrevision
9279
20823
ADD CONSTRAINT branchrevision__branch__fk FOREIGN KEY (branch) REFERENCES branch(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
9281
20826
ALTER TABLE ONLY branchrevision
9282
20827
ADD CONSTRAINT branchrevision__revision__fk FOREIGN KEY (revision) REFERENCES revision(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
9284
20830
ALTER TABLE ONLY branchsubscription
9285
20831
ADD CONSTRAINT branchsubscription_branch_fk FOREIGN KEY (branch) REFERENCES branch(id);
9287
20834
ALTER TABLE ONLY branchsubscription
9288
20835
ADD CONSTRAINT branchsubscription_person_fk FOREIGN KEY (person) REFERENCES person(id);
9290
20838
ALTER TABLE ONLY branchsubscription
9291
20839
ADD CONSTRAINT branchsubscription_subscribed_by_fkey FOREIGN KEY (subscribed_by) REFERENCES person(id);
9293
20842
ALTER TABLE ONLY branchvisibilitypolicy
9294
20843
ADD CONSTRAINT branchvisibilitypolicy_product_fkey FOREIGN KEY (product) REFERENCES product(id);
9296
20846
ALTER TABLE ONLY branchvisibilitypolicy
9297
20847
ADD CONSTRAINT branchvisibilitypolicy_project_fkey FOREIGN KEY (project) REFERENCES project(id);
9299
20850
ALTER TABLE ONLY branchvisibilitypolicy
9300
20851
ADD CONSTRAINT branchvisibilitypolicy_team_fkey FOREIGN KEY (team) REFERENCES person(id);
9302
20854
ALTER TABLE ONLY bug
9303
20855
ADD CONSTRAINT bug__who_made_private__fk FOREIGN KEY (who_made_private) REFERENCES person(id);
20858
ALTER TABLE ONLY bug
20859
ADD CONSTRAINT bug_access_policy_fkey FOREIGN KEY (access_policy) REFERENCES accesspolicy(id);
9305
20862
ALTER TABLE ONLY bug
9306
20863
ADD CONSTRAINT bug_duplicateof_fk FOREIGN KEY (duplicateof) REFERENCES bug(id);
9308
20866
ALTER TABLE ONLY bug
9309
20867
ADD CONSTRAINT bug_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
9311
20870
ALTER TABLE ONLY bugactivity
9312
20871
ADD CONSTRAINT bugactivity__person__fk FOREIGN KEY (person) REFERENCES person(id);
9314
20874
ALTER TABLE ONLY bugaffectsperson
9315
20875
ADD CONSTRAINT bugaffectsperson_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
9317
20878
ALTER TABLE ONLY bugaffectsperson
9318
20879
ADD CONSTRAINT bugaffectsperson_person_fkey FOREIGN KEY (person) REFERENCES person(id);
9320
20882
ALTER TABLE ONLY bugattachment
9321
20883
ADD CONSTRAINT bugattachment_bug_fk FOREIGN KEY (bug) REFERENCES bug(id);
9323
20886
ALTER TABLE ONLY bugattachment
9324
20887
ADD CONSTRAINT bugattachment_libraryfile_fk FOREIGN KEY (libraryfile) REFERENCES libraryfilealias(id);
9326
20890
ALTER TABLE ONLY bugattachment
9327
20891
ADD CONSTRAINT bugattachment_message_fk FOREIGN KEY (message) REFERENCES message(id);
9329
20894
ALTER TABLE ONLY bugbranch
9330
20895
ADD CONSTRAINT bugbranch_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
9332
20898
ALTER TABLE ONLY bugbranch
9333
20899
ADD CONSTRAINT bugbranch_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
9335
20902
ALTER TABLE ONLY bugbranch
9336
20903
ADD CONSTRAINT bugbranch_fixed_in_revision_fkey FOREIGN KEY (revision_hint) REFERENCES revision(id);
9338
20906
ALTER TABLE ONLY bugbranch
9339
20907
ADD CONSTRAINT bugbranch_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
9341
20910
ALTER TABLE ONLY bugcve
9342
20911
ADD CONSTRAINT bugcve_bug_fk FOREIGN KEY (bug) REFERENCES bug(id);
9344
20914
ALTER TABLE ONLY bugcve
9345
20915
ADD CONSTRAINT bugcve_cve_fk FOREIGN KEY (cve) REFERENCES cve(id);
9347
20918
ALTER TABLE ONLY bugjob
9348
20919
ADD CONSTRAINT bugjob_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
9350
20922
ALTER TABLE ONLY bugjob
9351
20923
ADD CONSTRAINT bugjob_job_fkey FOREIGN KEY (job) REFERENCES job(id);
9353
20926
ALTER TABLE ONLY bugmessage
9354
20927
ADD CONSTRAINT bugmessage__bug__fk FOREIGN KEY (bug) REFERENCES bug(id);
9356
20930
ALTER TABLE ONLY bugmessage
9357
20931
ADD CONSTRAINT bugmessage_bugwatch_fkey FOREIGN KEY (bugwatch) REFERENCES bugwatch(id);
9359
20934
ALTER TABLE ONLY bugmessage
9360
20935
ADD CONSTRAINT bugmessage_message_fk FOREIGN KEY (message) REFERENCES message(id);
20938
ALTER TABLE ONLY bugmute
20939
ADD CONSTRAINT bugmute_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id) ON DELETE CASCADE;
20942
ALTER TABLE ONLY bugmute
20943
ADD CONSTRAINT bugmute_person_fkey FOREIGN KEY (person) REFERENCES person(id) ON DELETE CASCADE;
9362
20946
ALTER TABLE ONLY bugnomination
9363
20947
ADD CONSTRAINT bugnomination__bug__fk FOREIGN KEY (bug) REFERENCES bug(id);
9365
20950
ALTER TABLE ONLY bugnomination
9366
20951
ADD CONSTRAINT bugnomination__decider__fk FOREIGN KEY (decider) REFERENCES person(id);
9368
20954
ALTER TABLE ONLY bugnomination
9369
20955
ADD CONSTRAINT bugnomination__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
9371
20958
ALTER TABLE ONLY bugnomination
9372
20959
ADD CONSTRAINT bugnomination__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
9374
20962
ALTER TABLE ONLY bugnomination
9375
20963
ADD CONSTRAINT bugnomination__productseries__fk FOREIGN KEY (productseries) REFERENCES productseries(id);
20966
ALTER TABLE ONLY bugnotification
20967
ADD CONSTRAINT bugnotification_activity_fkey FOREIGN KEY (activity) REFERENCES bugactivity(id);
9377
20970
ALTER TABLE ONLY bugnotification
9378
20971
ADD CONSTRAINT bugnotification_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
9380
20974
ALTER TABLE ONLY bugnotification
9381
20975
ADD CONSTRAINT bugnotification_message_fkey FOREIGN KEY (message) REFERENCES message(id);
9383
20978
ALTER TABLE ONLY bugnotificationarchive
9384
20979
ADD CONSTRAINT bugnotificationarchive__bug__fk FOREIGN KEY (bug) REFERENCES bug(id);
9386
20982
ALTER TABLE ONLY bugnotificationarchive
9387
20983
ADD CONSTRAINT bugnotificationarchive__message__fk FOREIGN KEY (message) REFERENCES message(id);
9389
20986
ALTER TABLE ONLY bugnotificationattachment
9390
20987
ADD CONSTRAINT bugnotificationattachment__bug_notification__fk FOREIGN KEY (bug_notification) REFERENCES bugnotification(id) ON DELETE CASCADE;
9392
20990
ALTER TABLE ONLY bugnotificationattachment
9393
20991
ADD CONSTRAINT bugnotificationattachment_message_fkey FOREIGN KEY (message) REFERENCES message(id);
20994
ALTER TABLE ONLY bugnotificationfilter
20995
ADD CONSTRAINT bugnotificationfilter_bug_notification_fkey FOREIGN KEY (bug_notification) REFERENCES bugnotification(id) ON DELETE CASCADE;
20998
ALTER TABLE ONLY bugnotificationfilter
20999
ADD CONSTRAINT bugnotificationfilter_bug_subscription_filter_fkey FOREIGN KEY (bug_subscription_filter) REFERENCES bugsubscriptionfilter(id) ON DELETE CASCADE;
9395
21002
ALTER TABLE ONLY bugnotificationrecipient
9396
21003
ADD CONSTRAINT bugnotificationrecipient__bug_notification__fk FOREIGN KEY (bug_notification) REFERENCES bugnotification(id) ON DELETE CASCADE;
9398
21006
ALTER TABLE ONLY bugnotificationrecipient
9399
21007
ADD CONSTRAINT bugnotificationrecipient_person_fkey FOREIGN KEY (person) REFERENCES person(id);
9401
21010
ALTER TABLE ONLY bugnotificationrecipientarchive
9402
21011
ADD CONSTRAINT bugnotificationrecipientarchive__bug_notification__fk FOREIGN KEY (bug_notification) REFERENCES bugnotificationarchive(id);
9404
21014
ALTER TABLE ONLY bugnotificationrecipientarchive
9405
21015
ADD CONSTRAINT bugnotificationrecipientarchive__person__fk FOREIGN KEY (person) REFERENCES person(id);
9407
ALTER TABLE ONLY bugpackageinfestation
9408
ADD CONSTRAINT bugpackageinfestation_bug_fk FOREIGN KEY (bug) REFERENCES bug(id);
9410
ALTER TABLE ONLY bugpackageinfestation
9411
ADD CONSTRAINT bugpackageinfestation_creator_fk FOREIGN KEY (creator) REFERENCES person(id);
9413
ALTER TABLE ONLY bugpackageinfestation
9414
ADD CONSTRAINT bugpackageinfestation_lastmodifiedby_fk FOREIGN KEY (lastmodifiedby) REFERENCES person(id);
9416
ALTER TABLE ONLY bugpackageinfestation
9417
ADD CONSTRAINT bugpackageinfestation_sourcepackagerelease_fk FOREIGN KEY (sourcepackagerelease) REFERENCES sourcepackagerelease(id);
9419
ALTER TABLE ONLY bugpackageinfestation
9420
ADD CONSTRAINT bugpackageinfestation_verifiedby_fk FOREIGN KEY (verifiedby) REFERENCES person(id);
9422
ALTER TABLE ONLY bugproductinfestation
9423
ADD CONSTRAINT bugproductinfestation_bug_fk FOREIGN KEY (bug) REFERENCES bug(id);
9425
ALTER TABLE ONLY bugproductinfestation
9426
ADD CONSTRAINT bugproductinfestation_creator_fk FOREIGN KEY (creator) REFERENCES person(id);
9428
ALTER TABLE ONLY bugproductinfestation
9429
ADD CONSTRAINT bugproductinfestation_lastmodifiedby_fk FOREIGN KEY (lastmodifiedby) REFERENCES person(id);
9431
ALTER TABLE ONLY bugproductinfestation
9432
ADD CONSTRAINT bugproductinfestation_productrelease_fk FOREIGN KEY (productrelease) REFERENCES productrelease(id);
9434
ALTER TABLE ONLY bugproductinfestation
9435
ADD CONSTRAINT bugproductinfestation_verifiedby_fk FOREIGN KEY (verifiedby) REFERENCES person(id);
9437
21018
ALTER TABLE ONLY bugsubscription
9438
21019
ADD CONSTRAINT bugsubscription_subscribed_by_fkey FOREIGN KEY (subscribed_by) REFERENCES person(id);
21022
ALTER TABLE ONLY bugsubscriptionfilter
21023
ADD CONSTRAINT bugsubscriptionfilter__structuralsubscription__fk FOREIGN KEY (structuralsubscription) REFERENCES structuralsubscription(id) ON DELETE CASCADE;
21026
ALTER TABLE ONLY bugsubscriptionfilterimportance
21027
ADD CONSTRAINT bugsubscriptionfilterimportance_filter_fkey FOREIGN KEY (filter) REFERENCES bugsubscriptionfilter(id);
21030
ALTER TABLE ONLY bugsubscriptionfiltermute
21031
ADD CONSTRAINT bugsubscriptionfiltermute_filter_fkey FOREIGN KEY (filter) REFERENCES bugsubscriptionfilter(id) ON DELETE CASCADE;
21034
ALTER TABLE ONLY bugsubscriptionfiltermute
21035
ADD CONSTRAINT bugsubscriptionfiltermute_person_fkey FOREIGN KEY (person) REFERENCES person(id) ON DELETE CASCADE;
21038
ALTER TABLE ONLY bugsubscriptionfilterstatus
21039
ADD CONSTRAINT bugsubscriptionfilterstatus_filter_fkey FOREIGN KEY (filter) REFERENCES bugsubscriptionfilter(id);
21042
ALTER TABLE ONLY bugsubscriptionfiltertag
21043
ADD CONSTRAINT bugsubscriptionfiltertag_filter_fkey FOREIGN KEY (filter) REFERENCES bugsubscriptionfilter(id);
21046
ALTER TABLE ONLY bugsummary
21047
ADD CONSTRAINT bugsummary_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id) ON DELETE CASCADE;
21050
ALTER TABLE ONLY bugsummary
21051
ADD CONSTRAINT bugsummary_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id) ON DELETE CASCADE;
21054
ALTER TABLE ONLY bugsummary
21055
ADD CONSTRAINT bugsummary_milestone_fkey FOREIGN KEY (milestone) REFERENCES milestone(id) ON DELETE CASCADE;
21058
ALTER TABLE ONLY bugsummary
21059
ADD CONSTRAINT bugsummary_product_fkey FOREIGN KEY (product) REFERENCES product(id) ON DELETE CASCADE;
21062
ALTER TABLE ONLY bugsummary
21063
ADD CONSTRAINT bugsummary_productseries_fkey FOREIGN KEY (productseries) REFERENCES productseries(id) ON DELETE CASCADE;
21066
ALTER TABLE ONLY bugsummary
21067
ADD CONSTRAINT bugsummary_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id) ON DELETE CASCADE;
21070
ALTER TABLE ONLY bugsummaryjournal
21071
ADD CONSTRAINT bugsummaryjournal_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id) ON DELETE CASCADE;
21074
ALTER TABLE ONLY bugsummaryjournal
21075
ADD CONSTRAINT bugsummaryjournal_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id) ON DELETE CASCADE;
21078
ALTER TABLE ONLY bugsummaryjournal
21079
ADD CONSTRAINT bugsummaryjournal_milestone_fkey FOREIGN KEY (milestone) REFERENCES milestone(id) ON DELETE CASCADE;
21082
ALTER TABLE ONLY bugsummaryjournal
21083
ADD CONSTRAINT bugsummaryjournal_product_fkey FOREIGN KEY (product) REFERENCES product(id) ON DELETE CASCADE;
21086
ALTER TABLE ONLY bugsummaryjournal
21087
ADD CONSTRAINT bugsummaryjournal_productseries_fkey FOREIGN KEY (productseries) REFERENCES productseries(id) ON DELETE CASCADE;
21090
ALTER TABLE ONLY bugsummaryjournal
21091
ADD CONSTRAINT bugsummaryjournal_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id) ON DELETE CASCADE;
21094
ALTER TABLE ONLY bugsummary
21095
ADD CONSTRAINT bugsummaryjournal_viewed_by_fkey FOREIGN KEY (viewed_by) REFERENCES person(id) ON DELETE CASCADE;
9440
21098
ALTER TABLE ONLY bugtask
9441
21099
ADD CONSTRAINT bugtask__assignee__fk FOREIGN KEY (assignee) REFERENCES person(id);
9443
21102
ALTER TABLE ONLY bugtask
9444
21103
ADD CONSTRAINT bugtask__binarypackagename__fk FOREIGN KEY (binarypackagename) REFERENCES binarypackagename(id);
9446
21106
ALTER TABLE ONLY bugtask
9447
21107
ADD CONSTRAINT bugtask__bug__fk FOREIGN KEY (bug) REFERENCES bug(id);
9449
21110
ALTER TABLE ONLY bugtask
9450
21111
ADD CONSTRAINT bugtask__bugwatch__fk FOREIGN KEY (bugwatch) REFERENCES bugwatch(id);
9452
21114
ALTER TABLE ONLY bugtask
9453
21115
ADD CONSTRAINT bugtask__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
9455
21118
ALTER TABLE ONLY bugtask
9456
21119
ADD CONSTRAINT bugtask__distribution__milestone__fk FOREIGN KEY (distribution, milestone) REFERENCES milestone(distribution, id);
9458
21122
ALTER TABLE ONLY bugtask
9459
21123
ADD CONSTRAINT bugtask__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
9461
21126
ALTER TABLE ONLY bugtask
9462
21127
ADD CONSTRAINT bugtask__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
9464
21130
ALTER TABLE ONLY bugtask
9465
21131
ADD CONSTRAINT bugtask__product__fk FOREIGN KEY (product) REFERENCES product(id);
9467
21134
ALTER TABLE ONLY bugtask
9468
21135
ADD CONSTRAINT bugtask__product__milestone__fk FOREIGN KEY (product, milestone) REFERENCES milestone(product, id);
9470
21138
ALTER TABLE ONLY bugtask
9471
21139
ADD CONSTRAINT bugtask__productseries__fk FOREIGN KEY (productseries) REFERENCES productseries(id);
9473
21142
ALTER TABLE ONLY bugtask
9474
21143
ADD CONSTRAINT bugtask__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
9476
21146
ALTER TABLE ONLY bugtracker
9477
21147
ADD CONSTRAINT bugtracker_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
9479
21150
ALTER TABLE ONLY bugtrackeralias
9480
21151
ADD CONSTRAINT bugtrackeralias__bugtracker__fk FOREIGN KEY (bugtracker) REFERENCES bugtracker(id);
21154
ALTER TABLE ONLY bugtrackercomponent
21155
ADD CONSTRAINT bugtrackercomponent_component_group_fkey FOREIGN KEY (component_group) REFERENCES bugtrackercomponentgroup(id);
21158
ALTER TABLE ONLY bugtrackercomponent
21159
ADD CONSTRAINT bugtrackercomponent_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
21162
ALTER TABLE ONLY bugtrackercomponent
21163
ADD CONSTRAINT bugtrackercomponent_source_package_name_fkey FOREIGN KEY (source_package_name) REFERENCES sourcepackagename(id);
21166
ALTER TABLE ONLY bugtrackercomponentgroup
21167
ADD CONSTRAINT bugtrackercomponentgroup_bug_tracker_fkey FOREIGN KEY (bug_tracker) REFERENCES bugtracker(id);
9482
21170
ALTER TABLE ONLY bugtrackerperson
9483
21171
ADD CONSTRAINT bugtrackerperson_bugtracker_fkey FOREIGN KEY (bugtracker) REFERENCES bugtracker(id);
9485
21174
ALTER TABLE ONLY bugtrackerperson
9486
21175
ADD CONSTRAINT bugtrackerperson_person_fkey FOREIGN KEY (person) REFERENCES person(id);
9488
21178
ALTER TABLE ONLY bugwatch
9489
21179
ADD CONSTRAINT bugwatch_bug_fk FOREIGN KEY (bug) REFERENCES bug(id);
9491
21182
ALTER TABLE ONLY bugwatch
9492
21183
ADD CONSTRAINT bugwatch_bugtracker_fk FOREIGN KEY (bugtracker) REFERENCES bugtracker(id);
9494
21186
ALTER TABLE ONLY bugwatch
9495
21187
ADD CONSTRAINT bugwatch_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
9497
21190
ALTER TABLE ONLY bugwatchactivity
9498
21191
ADD CONSTRAINT bugwatchactivity_bug_watch_fkey FOREIGN KEY (bug_watch) REFERENCES bugwatch(id);
9500
21194
ALTER TABLE ONLY buildfarmjob
9501
21195
ADD CONSTRAINT buildfarmjob__builder__fk FOREIGN KEY (builder) REFERENCES builder(id);
9503
21198
ALTER TABLE ONLY buildfarmjob
9504
21199
ADD CONSTRAINT buildfarmjob__log__fk FOREIGN KEY (log) REFERENCES libraryfilealias(id);
9506
21202
ALTER TABLE ONLY buildfarmjob
9507
21203
ADD CONSTRAINT buildfarmjob__processor__fk FOREIGN KEY (processor) REFERENCES processor(id);
9509
21206
ALTER TABLE ONLY buildpackagejob
9510
21207
ADD CONSTRAINT buildpackagejob__job__fk FOREIGN KEY (job) REFERENCES job(id);
9512
21210
ALTER TABLE ONLY buildpackagejob
9513
21211
ADD CONSTRAINT buildpackagejob_build_fk FOREIGN KEY (build) REFERENCES binarypackagebuild(id);
9515
21214
ALTER TABLE ONLY buildqueue
9516
21215
ADD CONSTRAINT buildqueue__job__fk FOREIGN KEY (job) REFERENCES job(id);
9518
21218
ALTER TABLE ONLY buildqueue
9519
21219
ADD CONSTRAINT buildqueue__processor__fk FOREIGN KEY (processor) REFERENCES processor(id);
9521
21222
ALTER TABLE ONLY codeimport
9522
21223
ADD CONSTRAINT codeimport_assignee_fkey FOREIGN KEY (assignee) REFERENCES person(id);
9524
21226
ALTER TABLE ONLY codeimport
9525
21227
ADD CONSTRAINT codeimport_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
9527
21230
ALTER TABLE ONLY codeimport
9528
21231
ADD CONSTRAINT codeimport_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
9530
21234
ALTER TABLE ONLY codeimport
9531
21235
ADD CONSTRAINT codeimport_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
9533
21238
ALTER TABLE ONLY codeimportevent
9534
21239
ADD CONSTRAINT codeimportevent__code_import__fk FOREIGN KEY (code_import) REFERENCES codeimport(id) ON DELETE CASCADE;
9536
21242
ALTER TABLE ONLY codeimportevent
9537
21243
ADD CONSTRAINT codeimportevent__machine__fk FOREIGN KEY (machine) REFERENCES codeimportmachine(id);
9539
21246
ALTER TABLE ONLY codeimportevent
9540
21247
ADD CONSTRAINT codeimportevent__person__fk FOREIGN KEY (person) REFERENCES person(id);
9542
21250
ALTER TABLE ONLY codeimporteventdata
9543
21251
ADD CONSTRAINT codeimporteventdata__event__fk FOREIGN KEY (event) REFERENCES codeimportevent(id) ON DELETE CASCADE;
9545
21254
ALTER TABLE ONLY codeimportjob
9546
21255
ADD CONSTRAINT codeimportjob__code_import__fk FOREIGN KEY (code_import) REFERENCES codeimport(id);
9548
21258
ALTER TABLE ONLY codeimportjob
9549
21259
ADD CONSTRAINT codeimportjob__machine__fk FOREIGN KEY (machine) REFERENCES codeimportmachine(id);
9551
21262
ALTER TABLE ONLY codeimportjob
9552
21263
ADD CONSTRAINT codeimportjob__requesting_user__fk FOREIGN KEY (requesting_user) REFERENCES person(id);
9554
21266
ALTER TABLE ONLY codeimportresult
9555
21267
ADD CONSTRAINT codeimportresult__code_import__fk FOREIGN KEY (code_import) REFERENCES codeimport(id) ON DELETE CASCADE;
9557
21270
ALTER TABLE ONLY codeimportresult
9558
21271
ADD CONSTRAINT codeimportresult__log_file__fk FOREIGN KEY (log_file) REFERENCES libraryfilealias(id);
9560
21274
ALTER TABLE ONLY codeimportresult
9561
21275
ADD CONSTRAINT codeimportresult__machine__fk FOREIGN KEY (machine) REFERENCES codeimportmachine(id);
9563
21278
ALTER TABLE ONLY codeimportresult
9564
21279
ADD CONSTRAINT codeimportresult__requesting_user__fk FOREIGN KEY (requesting_user) REFERENCES person(id);
9566
21282
ALTER TABLE ONLY codereviewmessage
9567
21283
ADD CONSTRAINT codereviewmessage_branch_merge_proposal_fkey FOREIGN KEY (branch_merge_proposal) REFERENCES branchmergeproposal(id);
9569
21286
ALTER TABLE ONLY codereviewmessage
9570
21287
ADD CONSTRAINT codereviewmessage_message_fkey FOREIGN KEY (message) REFERENCES message(id);
9572
21290
ALTER TABLE ONLY codereviewvote
9573
21291
ADD CONSTRAINT codereviewvote_branch_merge_proposal_fkey FOREIGN KEY (branch_merge_proposal) REFERENCES branchmergeproposal(id);
9575
21294
ALTER TABLE ONLY codereviewvote
9576
21295
ADD CONSTRAINT codereviewvote_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
9578
21298
ALTER TABLE ONLY codereviewvote
9579
21299
ADD CONSTRAINT codereviewvote_reviewer_fkey FOREIGN KEY (reviewer) REFERENCES person(id);
9581
21302
ALTER TABLE ONLY codereviewvote
9582
21303
ADD CONSTRAINT codereviewvote_vote_message_fkey FOREIGN KEY (vote_message) REFERENCES codereviewmessage(id);
9584
21306
ALTER TABLE ONLY commercialsubscription
9585
21307
ADD CONSTRAINT commercialsubscription__product__fk FOREIGN KEY (product) REFERENCES product(id);
9587
21310
ALTER TABLE ONLY commercialsubscription
9588
21311
ADD CONSTRAINT commercialsubscription__purchaser__fk FOREIGN KEY (purchaser) REFERENCES person(id);
9590
21314
ALTER TABLE ONLY commercialsubscription
9591
21315
ADD CONSTRAINT commercialsubscription__registrant__fk FOREIGN KEY (registrant) REFERENCES person(id);
9593
21318
ALTER TABLE ONLY componentselection
9594
21319
ADD CONSTRAINT componentselection__component__fk FOREIGN KEY (component) REFERENCES component(id);
9596
21322
ALTER TABLE ONLY componentselection
9597
21323
ADD CONSTRAINT componentselection__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
9599
21326
ALTER TABLE ONLY customlanguagecode
9600
21327
ADD CONSTRAINT customlanguagecode_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
9602
21330
ALTER TABLE ONLY customlanguagecode
9603
21331
ADD CONSTRAINT customlanguagecode_language_fkey FOREIGN KEY (language) REFERENCES language(id);
9605
21334
ALTER TABLE ONLY customlanguagecode
9606
21335
ADD CONSTRAINT customlanguagecode_product_fkey FOREIGN KEY (product) REFERENCES product(id);
9608
21338
ALTER TABLE ONLY customlanguagecode
9609
21339
ADD CONSTRAINT customlanguagecode_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
9611
21342
ALTER TABLE ONLY cvereference
9612
21343
ADD CONSTRAINT cvereference_cve_fk FOREIGN KEY (cve) REFERENCES cve(id);
9614
21346
ALTER TABLE ONLY diff
9615
21347
ADD CONSTRAINT diff_diff_text_fkey FOREIGN KEY (diff_text) REFERENCES libraryfilealias(id);
21350
ALTER TABLE ONLY incrementaldiff
21351
ADD CONSTRAINT diff_fk FOREIGN KEY (diff) REFERENCES diff(id) ON DELETE CASCADE;
9617
21354
ALTER TABLE ONLY distribution
9618
21355
ADD CONSTRAINT distribution__icon__fk FOREIGN KEY (icon) REFERENCES libraryfilealias(id);
9620
21358
ALTER TABLE ONLY distribution
9621
21359
ADD CONSTRAINT distribution__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
9623
21362
ALTER TABLE ONLY distribution
9624
21363
ADD CONSTRAINT distribution__mugshot__fk FOREIGN KEY (mugshot) REFERENCES libraryfilealias(id);
9626
21366
ALTER TABLE ONLY distribution
9627
21367
ADD CONSTRAINT distribution_driver_fk FOREIGN KEY (driver) REFERENCES person(id);
9629
21370
ALTER TABLE ONLY distribution
9630
21371
ADD CONSTRAINT distribution_language_pack_admin_fkey FOREIGN KEY (language_pack_admin) REFERENCES person(id);
9632
21374
ALTER TABLE ONLY distribution
9633
21375
ADD CONSTRAINT distribution_mirror_admin_fkey FOREIGN KEY (mirror_admin) REFERENCES person(id);
21378
ALTER TABLE ONLY distribution
21379
ADD CONSTRAINT distribution_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
9635
21382
ALTER TABLE ONLY distribution
9636
21383
ADD CONSTRAINT distribution_security_contact_fkey FOREIGN KEY (security_contact) REFERENCES person(id);
9638
21386
ALTER TABLE ONLY distribution
9639
21387
ADD CONSTRAINT distribution_translation_focus_fkey FOREIGN KEY (translation_focus) REFERENCES distroseries(id);
9641
21390
ALTER TABLE ONLY distribution
9642
21391
ADD CONSTRAINT distribution_translationgroup_fk FOREIGN KEY (translationgroup) REFERENCES translationgroup(id);
9644
21394
ALTER TABLE ONLY distribution
9645
21395
ADD CONSTRAINT distribution_upload_admin_fk FOREIGN KEY (upload_admin) REFERENCES person(id);
9647
ALTER TABLE ONLY distributionbounty
9648
ADD CONSTRAINT distributionbounty_bounty_fk FOREIGN KEY (bounty) REFERENCES bounty(id);
9650
ALTER TABLE ONLY distributionbounty
9651
ADD CONSTRAINT distributionbounty_distribution_fk FOREIGN KEY (distribution) REFERENCES distribution(id);
21398
ALTER TABLE ONLY distributionjob
21399
ADD CONSTRAINT distributionjob__job__fk FOREIGN KEY (job) REFERENCES job(id);
21402
ALTER TABLE ONLY distributionjob
21403
ADD CONSTRAINT distributionjob_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
21406
ALTER TABLE ONLY distributionjob
21407
ADD CONSTRAINT distributionjob_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id);
9653
21410
ALTER TABLE ONLY distributionmirror
9654
21411
ADD CONSTRAINT distributionmirror_country_fkey FOREIGN KEY (country) REFERENCES country(id);
9656
21414
ALTER TABLE ONLY distributionmirror
9657
21415
ADD CONSTRAINT distributionmirror_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
9659
21418
ALTER TABLE ONLY distributionmirror
9660
21419
ADD CONSTRAINT distributionmirror_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
9662
21422
ALTER TABLE ONLY distributionmirror
9663
21423
ADD CONSTRAINT distributionmirror_reviewer_fkey FOREIGN KEY (reviewer) REFERENCES person(id);
9665
21426
ALTER TABLE ONLY distributionsourcepackage
9666
21427
ADD CONSTRAINT distributionpackage__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
9668
21430
ALTER TABLE ONLY distributionsourcepackage
9669
21431
ADD CONSTRAINT distributionpackage__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
9671
21434
ALTER TABLE ONLY distributionsourcepackagecache
9672
21435
ADD CONSTRAINT distributionsourcepackagecache__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
9674
21438
ALTER TABLE ONLY distributionsourcepackagecache
9675
21439
ADD CONSTRAINT distributionsourcepackagecache_distribution_fk FOREIGN KEY (distribution) REFERENCES distribution(id);
9677
21442
ALTER TABLE ONLY distributionsourcepackagecache
9678
21443
ADD CONSTRAINT distributionsourcepackagecache_sourcepackagename_fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
9680
21446
ALTER TABLE ONLY distroarchseries
9681
21447
ADD CONSTRAINT distroarchseries__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
9683
21450
ALTER TABLE ONLY distroarchseries
9684
21451
ADD CONSTRAINT distroarchseries__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
9686
21454
ALTER TABLE ONLY distroarchseries
9687
21455
ADD CONSTRAINT distroarchseries__processorfamily__fk FOREIGN KEY (processorfamily) REFERENCES processorfamily(id);
9689
ALTER TABLE ONLY distrocomponentuploader
9690
ADD CONSTRAINT distrocomponentuploader_component_fk FOREIGN KEY (component) REFERENCES component(id);
9692
ALTER TABLE ONLY distrocomponentuploader
9693
ADD CONSTRAINT distrocomponentuploader_distribution_fk FOREIGN KEY (distribution) REFERENCES distribution(id);
9695
ALTER TABLE ONLY distrocomponentuploader
9696
ADD CONSTRAINT distrocomponentuploader_uploader_fk FOREIGN KEY (uploader) REFERENCES person(id);
9698
21458
ALTER TABLE ONLY distroseries
9699
21459
ADD CONSTRAINT distrorelease_parentrelease_fk FOREIGN KEY (parent_series) REFERENCES distroseries(id);
9701
21462
ALTER TABLE ONLY distroserieslanguage
9702
21463
ADD CONSTRAINT distroreleaselanguage_language_fk FOREIGN KEY (language) REFERENCES language(id);
9704
21466
ALTER TABLE ONLY distroseries
9705
21467
ADD CONSTRAINT distroseries__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
9707
21470
ALTER TABLE ONLY distroseries
9708
21471
ADD CONSTRAINT distroseries__driver__fk FOREIGN KEY (driver) REFERENCES person(id);
9710
21474
ALTER TABLE ONLY distroseries
9711
21475
ADD CONSTRAINT distroseries__language_pack_base__fk FOREIGN KEY (language_pack_base) REFERENCES languagepack(id);
9713
21478
ALTER TABLE ONLY distroseries
9714
21479
ADD CONSTRAINT distroseries__language_pack_delta__fk FOREIGN KEY (language_pack_delta) REFERENCES languagepack(id);
9716
21482
ALTER TABLE ONLY distroseries
9717
21483
ADD CONSTRAINT distroseries__language_pack_proposed__fk FOREIGN KEY (language_pack_proposed) REFERENCES languagepack(id);
9719
21486
ALTER TABLE ONLY distroseries
9720
21487
ADD CONSTRAINT distroseries__nominatedarchindep__fk FOREIGN KEY (nominatedarchindep) REFERENCES distroarchseries(id);
9722
ALTER TABLE ONLY distroseries
9723
ADD CONSTRAINT distroseries__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
9725
21490
ALTER TABLE ONLY distroseries
9726
21491
ADD CONSTRAINT distroseries__parent_series__fk FOREIGN KEY (parent_series) REFERENCES distroseries(id);
21494
ALTER TABLE ONLY distroseries
21495
ADD CONSTRAINT distroseries__registrant__fk FOREIGN KEY (registrant) REFERENCES person(id);
21498
ALTER TABLE ONLY packagingjob
21499
ADD CONSTRAINT distroseries_fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21502
ALTER TABLE ONLY distroseriesdifference
21503
ADD CONSTRAINT distroseriesdifference__derived_series__fk FOREIGN KEY (derived_series) REFERENCES distroseries(id);
21506
ALTER TABLE ONLY distroseriesdifference
21507
ADD CONSTRAINT distroseriesdifference__package_diff__fk FOREIGN KEY (package_diff) REFERENCES packagediff(id);
21510
ALTER TABLE ONLY distroseriesdifference
21511
ADD CONSTRAINT distroseriesdifference__parent_package_diff__fk FOREIGN KEY (parent_package_diff) REFERENCES packagediff(id);
21514
ALTER TABLE ONLY distroseriesdifference
21515
ADD CONSTRAINT distroseriesdifference__parentseries__fk FOREIGN KEY (parent_series) REFERENCES distroseries(id);
21518
ALTER TABLE ONLY distroseriesdifference
21519
ADD CONSTRAINT distroseriesdifference__source_package_name__fk FOREIGN KEY (source_package_name) REFERENCES sourcepackagename(id);
21522
ALTER TABLE ONLY distroseriesdifferencemessage
21523
ADD CONSTRAINT distroseriesdifferencemessage__distro_series_difference__fk FOREIGN KEY (distro_series_difference) REFERENCES distroseriesdifference(id);
21526
ALTER TABLE ONLY distroseriesdifferencemessage
21527
ADD CONSTRAINT distroseriesdifferencemessage__message__fk FOREIGN KEY (message) REFERENCES message(id);
9728
21530
ALTER TABLE ONLY distroserieslanguage
9729
21531
ADD CONSTRAINT distroserieslanguage__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
9731
21534
ALTER TABLE ONLY distroserieslanguage
9732
21535
ADD CONSTRAINT distroserieslanguage__language__fk FOREIGN KEY (language) REFERENCES language(id);
9734
21538
ALTER TABLE ONLY distroseriespackagecache
9735
21539
ADD CONSTRAINT distroseriespackagecache__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
9737
21542
ALTER TABLE ONLY distroseriespackagecache
9738
21543
ADD CONSTRAINT distroseriespackagecache__binarypackagename__fk FOREIGN KEY (binarypackagename) REFERENCES binarypackagename(id);
9740
21546
ALTER TABLE ONLY distroseriespackagecache
9741
21547
ADD CONSTRAINT distroseriespackagecache__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21550
ALTER TABLE ONLY distroseriesparent
21551
ADD CONSTRAINT distroseriesparent__derivedseries__fk FOREIGN KEY (derived_series) REFERENCES distroseries(id);
21554
ALTER TABLE ONLY distroseriesparent
21555
ADD CONSTRAINT distroseriesparent__parentseries__fk FOREIGN KEY (parent_series) REFERENCES distroseries(id);
21558
ALTER TABLE ONLY distroseriesparent
21559
ADD CONSTRAINT distroseriesparent_component_fkey FOREIGN KEY (component) REFERENCES component(id);
9743
21562
ALTER TABLE ONLY emailaddress
9744
21563
ADD CONSTRAINT emailaddress__account__fk FOREIGN KEY (account) REFERENCES account(id) ON DELETE SET NULL;
9746
21566
ALTER TABLE ONLY emailaddress
9747
21567
ADD CONSTRAINT emailaddress__person__fk FOREIGN KEY (person) REFERENCES person(id);
9749
21570
ALTER TABLE ONLY entitlement
9750
21571
ADD CONSTRAINT entitlement_approved_by_fkey FOREIGN KEY (approved_by) REFERENCES person(id);
9752
21574
ALTER TABLE ONLY entitlement
9753
21575
ADD CONSTRAINT entitlement_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
9755
21578
ALTER TABLE ONLY entitlement
9756
21579
ADD CONSTRAINT entitlement_person_fkey FOREIGN KEY (person) REFERENCES person(id);
9758
21582
ALTER TABLE ONLY entitlement
9759
21583
ADD CONSTRAINT entitlement_product_fkey FOREIGN KEY (product) REFERENCES product(id);
9761
21586
ALTER TABLE ONLY entitlement
9762
21587
ADD CONSTRAINT entitlement_project_fkey FOREIGN KEY (project) REFERENCES project(id);
9764
21590
ALTER TABLE ONLY entitlement
9765
21591
ADD CONSTRAINT entitlement_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
9767
21594
ALTER TABLE ONLY faq
9768
21595
ADD CONSTRAINT faq_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
9770
21598
ALTER TABLE ONLY faq
9771
21599
ADD CONSTRAINT faq_last_updated_by_fkey FOREIGN KEY (last_updated_by) REFERENCES person(id);
9773
21602
ALTER TABLE ONLY faq
9774
21603
ADD CONSTRAINT faq_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
9776
21606
ALTER TABLE ONLY faq
9777
21607
ADD CONSTRAINT faq_product_fkey FOREIGN KEY (product) REFERENCES product(id);
9779
21610
ALTER TABLE ONLY featuredproject
9780
21611
ADD CONSTRAINT featuredproject_pillar_name_fkey FOREIGN KEY (pillar_name) REFERENCES pillarname(id);
21614
ALTER TABLE ONLY featureflagchangelogentry
21615
ADD CONSTRAINT featureflagchangelogentry_person_fkey FOREIGN KEY (person) REFERENCES person(id);
9782
21618
ALTER TABLE ONLY flatpackagesetinclusion
9783
21619
ADD CONSTRAINT flatpackagesetinclusion__child__fk FOREIGN KEY (child) REFERENCES packageset(id);
9785
21622
ALTER TABLE ONLY flatpackagesetinclusion
9786
21623
ADD CONSTRAINT flatpackagesetinclusion__parent__fk FOREIGN KEY (parent) REFERENCES packageset(id);
9788
21626
ALTER TABLE ONLY gpgkey
9789
21627
ADD CONSTRAINT gpgkey_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
9791
21630
ALTER TABLE ONLY hwdevice
9792
21631
ADD CONSTRAINT hwdevice_bus_vendor_id_fkey FOREIGN KEY (bus_vendor_id) REFERENCES hwvendorid(id);
9794
21634
ALTER TABLE ONLY hwdeviceclass
9795
21635
ADD CONSTRAINT hwdeviceclass_device_fkey FOREIGN KEY (device) REFERENCES hwdevice(id);
9797
21638
ALTER TABLE ONLY hwdevicedriverlink
9798
21639
ADD CONSTRAINT hwdevicedriverlink_device_fkey FOREIGN KEY (device) REFERENCES hwdevice(id);
9800
21642
ALTER TABLE ONLY hwdevicedriverlink
9801
21643
ADD CONSTRAINT hwdevicedriverlink_driver_fkey FOREIGN KEY (driver) REFERENCES hwdriver(id);
9803
21646
ALTER TABLE ONLY hwdevicenamevariant
9804
21647
ADD CONSTRAINT hwdevicenamevariant_device_fkey FOREIGN KEY (device) REFERENCES hwdevice(id);
9806
21650
ALTER TABLE ONLY hwdevicenamevariant
9807
21651
ADD CONSTRAINT hwdevicenamevariant_vendor_name_fkey FOREIGN KEY (vendor_name) REFERENCES hwvendorname(id);
9809
21654
ALTER TABLE ONLY hwdmihandle
9810
21655
ADD CONSTRAINT hwdmihandle_submission_fkey FOREIGN KEY (submission) REFERENCES hwsubmission(id);
9812
21658
ALTER TABLE ONLY hwdmivalue
9813
21659
ADD CONSTRAINT hwdmivalue_handle_fkey FOREIGN KEY (handle) REFERENCES hwdmihandle(id);
9815
21662
ALTER TABLE ONLY hwsubmission
9816
21663
ADD CONSTRAINT hwsubmission__distroarchseries__fk FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
9818
21666
ALTER TABLE ONLY hwsubmission
9819
21667
ADD CONSTRAINT hwsubmission__owned__fk FOREIGN KEY (owner) REFERENCES person(id);
9821
21670
ALTER TABLE ONLY hwsubmission
9822
21671
ADD CONSTRAINT hwsubmission__raw_submission__fk FOREIGN KEY (raw_submission) REFERENCES libraryfilealias(id);
9824
21674
ALTER TABLE ONLY hwsubmission
9825
21675
ADD CONSTRAINT hwsubmission__system_fingerprint__fk FOREIGN KEY (system_fingerprint) REFERENCES hwsystemfingerprint(id);
9827
21678
ALTER TABLE ONLY hwsubmissionbug
9828
21679
ADD CONSTRAINT hwsubmissionbug_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
9830
21682
ALTER TABLE ONLY hwsubmissionbug
9831
21683
ADD CONSTRAINT hwsubmissionbug_submission_fkey FOREIGN KEY (submission) REFERENCES hwsubmission(id);
9833
21686
ALTER TABLE ONLY hwsubmissiondevice
9834
21687
ADD CONSTRAINT hwsubmissiondevice_device_driver_link_fkey FOREIGN KEY (device_driver_link) REFERENCES hwdevicedriverlink(id);
9836
21690
ALTER TABLE ONLY hwsubmissiondevice
9837
21691
ADD CONSTRAINT hwsubmissiondevice_parent_fkey FOREIGN KEY (parent) REFERENCES hwsubmissiondevice(id);
9839
21694
ALTER TABLE ONLY hwsubmissiondevice
9840
21695
ADD CONSTRAINT hwsubmissiondevice_submission_fkey FOREIGN KEY (submission) REFERENCES hwsubmission(id);
9842
21698
ALTER TABLE ONLY hwtestanswer
9843
21699
ADD CONSTRAINT hwtestanswer__choice__test__fk FOREIGN KEY (test, choice) REFERENCES hwtestanswerchoice(test, id);
9845
21702
ALTER TABLE ONLY hwtestanswer
9846
21703
ADD CONSTRAINT hwtestanswer_choice_fkey FOREIGN KEY (choice) REFERENCES hwtestanswerchoice(id);
9848
21706
ALTER TABLE ONLY hwtestanswer
9849
21707
ADD CONSTRAINT hwtestanswer_language_fkey FOREIGN KEY (language) REFERENCES language(id);
9851
21710
ALTER TABLE ONLY hwtestanswer
9852
21711
ADD CONSTRAINT hwtestanswer_submission_fkey FOREIGN KEY (submission) REFERENCES hwsubmission(id);
9854
21714
ALTER TABLE ONLY hwtestanswer
9855
21715
ADD CONSTRAINT hwtestanswer_test_fkey FOREIGN KEY (test) REFERENCES hwtest(id);
9857
21718
ALTER TABLE ONLY hwtestanswerchoice
9858
21719
ADD CONSTRAINT hwtestanswerchoice_test_fkey FOREIGN KEY (test) REFERENCES hwtest(id);
9860
21722
ALTER TABLE ONLY hwtestanswercount
9861
21723
ADD CONSTRAINT hwtestanswercount_choice_fkey FOREIGN KEY (choice) REFERENCES hwtestanswerchoice(id);
9863
21726
ALTER TABLE ONLY hwtestanswercount
9864
21727
ADD CONSTRAINT hwtestanswercount_distroarchseries_fkey FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
9866
21730
ALTER TABLE ONLY hwtestanswercount
9867
21731
ADD CONSTRAINT hwtestanswercount_test_fkey FOREIGN KEY (test) REFERENCES hwtest(id);
9869
21734
ALTER TABLE ONLY hwtestanswercountdevice
9870
21735
ADD CONSTRAINT hwtestanswercountdevice_answer_fkey FOREIGN KEY (answer) REFERENCES hwtestanswercount(id);
9872
21738
ALTER TABLE ONLY hwtestanswercountdevice
9873
21739
ADD CONSTRAINT hwtestanswercountdevice_device_driver_fkey FOREIGN KEY (device_driver) REFERENCES hwdevicedriverlink(id);
9875
21742
ALTER TABLE ONLY hwtestanswerdevice
9876
21743
ADD CONSTRAINT hwtestanswerdevice_answer_fkey FOREIGN KEY (answer) REFERENCES hwtestanswer(id);
9878
21746
ALTER TABLE ONLY hwtestanswerdevice
9879
21747
ADD CONSTRAINT hwtestanswerdevice_device_driver_fkey FOREIGN KEY (device_driver) REFERENCES hwdevicedriverlink(id);
9881
21750
ALTER TABLE ONLY hwvendorid
9882
21751
ADD CONSTRAINT hwvendorid_vendor_name_fkey FOREIGN KEY (vendor_name) REFERENCES hwvendorname(id);
9884
21754
ALTER TABLE ONLY ircid
9885
21755
ADD CONSTRAINT ircid_person_fk FOREIGN KEY (person) REFERENCES person(id);
9887
21758
ALTER TABLE ONLY jabberid
9888
21759
ADD CONSTRAINT jabberid_person_fk FOREIGN KEY (person) REFERENCES person(id);
21762
ALTER TABLE ONLY packagingjob
21763
ADD CONSTRAINT job_fk FOREIGN KEY (job) REFERENCES job(id) ON DELETE CASCADE;
9890
21766
ALTER TABLE ONLY job
9891
21767
ADD CONSTRAINT job_requester_fkey FOREIGN KEY (requester) REFERENCES person(id);
9893
21770
ALTER TABLE ONLY karma
9894
21771
ADD CONSTRAINT karma_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
9896
21774
ALTER TABLE ONLY karma
9897
21775
ADD CONSTRAINT karma_person_fk FOREIGN KEY (person) REFERENCES person(id);
9899
21778
ALTER TABLE ONLY karma
9900
21779
ADD CONSTRAINT karma_product_fkey FOREIGN KEY (product) REFERENCES product(id);
9902
21782
ALTER TABLE ONLY karma
9903
21783
ADD CONSTRAINT karma_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
9905
21786
ALTER TABLE ONLY karmaaction
9906
21787
ADD CONSTRAINT karmaaction_category_fk FOREIGN KEY (category) REFERENCES karmacategory(id);
9908
21790
ALTER TABLE ONLY karmacache
9909
21791
ADD CONSTRAINT karmacache_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
9911
21794
ALTER TABLE ONLY karmacache
9912
21795
ADD CONSTRAINT karmacache_product_fkey FOREIGN KEY (product) REFERENCES product(id);
9914
21798
ALTER TABLE ONLY karmacache
9915
21799
ADD CONSTRAINT karmacache_project_fkey FOREIGN KEY (project) REFERENCES project(id);
9917
21802
ALTER TABLE ONLY karmacache
9918
21803
ADD CONSTRAINT karmacache_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
9920
21806
ALTER TABLE ONLY karmatotalcache
9921
21807
ADD CONSTRAINT karmatotalcache_person_fk FOREIGN KEY (person) REFERENCES person(id) ON DELETE CASCADE;
9923
21810
ALTER TABLE ONLY languagepack
9924
21811
ADD CONSTRAINT languagepack__file__fk FOREIGN KEY (file) REFERENCES libraryfilealias(id);
9926
21814
ALTER TABLE ONLY languagepack
9927
21815
ADD CONSTRAINT languagepack__updates__fk FOREIGN KEY (updates) REFERENCES languagepack(id);
9929
21818
ALTER TABLE ONLY languagepack
9930
21819
ADD CONSTRAINT languagepackage__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
9932
21822
ALTER TABLE ONLY libraryfiledownloadcount
9933
21823
ADD CONSTRAINT libraryfiledownloadcount__libraryfilealias__fk FOREIGN KEY (libraryfilealias) REFERENCES libraryfilealias(id) ON DELETE CASCADE;
9935
21826
ALTER TABLE ONLY libraryfiledownloadcount
9936
21827
ADD CONSTRAINT libraryfiledownloadcount_country_fkey FOREIGN KEY (country) REFERENCES country(id);
9938
21830
ALTER TABLE ONLY logintoken
9939
21831
ADD CONSTRAINT logintoken_requester_fk FOREIGN KEY (requester) REFERENCES person(id);
9941
21834
ALTER TABLE ONLY mailinglist
9942
21835
ADD CONSTRAINT mailinglist_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
9944
21838
ALTER TABLE ONLY mailinglist
9945
21839
ADD CONSTRAINT mailinglist_reviewer_fkey FOREIGN KEY (reviewer) REFERENCES person(id);
9947
21842
ALTER TABLE ONLY mailinglist
9948
21843
ADD CONSTRAINT mailinglist_team_fkey FOREIGN KEY (team) REFERENCES person(id);
9950
ALTER TABLE ONLY mailinglistban
9951
ADD CONSTRAINT mailinglistban_banned_by_fkey FOREIGN KEY (banned_by) REFERENCES person(id);
9953
ALTER TABLE ONLY mailinglistban
9954
ADD CONSTRAINT mailinglistban_person_fkey FOREIGN KEY (person) REFERENCES person(id);
9956
21846
ALTER TABLE ONLY mailinglistsubscription
9957
21847
ADD CONSTRAINT mailinglistsubscription__email_address_fk FOREIGN KEY (email_address) REFERENCES emailaddress(id) ON DELETE CASCADE;
9959
21850
ALTER TABLE ONLY mailinglistsubscription
9960
21851
ADD CONSTRAINT mailinglistsubscription_mailing_list_fkey FOREIGN KEY (mailing_list) REFERENCES mailinglist(id);
9962
21854
ALTER TABLE ONLY mailinglistsubscription
9963
21855
ADD CONSTRAINT mailinglistsubscription_person_fkey FOREIGN KEY (person) REFERENCES person(id);
9965
ALTER TABLE ONLY mentoringoffer
9966
ADD CONSTRAINT mentoringoffer_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
9968
ALTER TABLE ONLY mentoringoffer
9969
ADD CONSTRAINT mentoringoffer_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
9971
ALTER TABLE ONLY mentoringoffer
9972
ADD CONSTRAINT mentoringoffer_specification_fkey FOREIGN KEY (specification) REFERENCES specification(id);
9974
ALTER TABLE ONLY mentoringoffer
9975
ADD CONSTRAINT mentoringoffer_team_fkey FOREIGN KEY (team) REFERENCES person(id);
9977
21858
ALTER TABLE ONLY mergedirectivejob
9978
21859
ADD CONSTRAINT mergedirectivejob_job_fkey FOREIGN KEY (job) REFERENCES job(id) ON DELETE CASCADE;
9980
21862
ALTER TABLE ONLY mergedirectivejob
9981
21863
ADD CONSTRAINT mergedirectivejob_merge_directive_fkey FOREIGN KEY (merge_directive) REFERENCES libraryfilealias(id);
9983
21866
ALTER TABLE ONLY message
9984
21867
ADD CONSTRAINT message_distribution_fk FOREIGN KEY (distribution) REFERENCES distribution(id);
9986
21870
ALTER TABLE ONLY message
9987
21871
ADD CONSTRAINT message_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
9989
21874
ALTER TABLE ONLY message
9990
21875
ADD CONSTRAINT message_parent_fk FOREIGN KEY (parent) REFERENCES message(id);
9992
21878
ALTER TABLE ONLY message
9993
21879
ADD CONSTRAINT message_raw_fk FOREIGN KEY (raw) REFERENCES libraryfilealias(id);
9995
21882
ALTER TABLE ONLY messageapproval
9996
21883
ADD CONSTRAINT messageapproval_disposed_by_fkey FOREIGN KEY (disposed_by) REFERENCES person(id);
9998
21886
ALTER TABLE ONLY messageapproval
9999
21887
ADD CONSTRAINT messageapproval_mailing_list_fkey FOREIGN KEY (mailing_list) REFERENCES mailinglist(id);
10001
21890
ALTER TABLE ONLY messageapproval
10002
21891
ADD CONSTRAINT messageapproval_message_fkey FOREIGN KEY (message) REFERENCES message(id);
10004
21894
ALTER TABLE ONLY messageapproval
10005
21895
ADD CONSTRAINT messageapproval_posted_by_fkey FOREIGN KEY (posted_by) REFERENCES person(id);
10007
21898
ALTER TABLE ONLY messageapproval
10008
21899
ADD CONSTRAINT messageapproval_posted_message_fkey FOREIGN KEY (posted_message) REFERENCES libraryfilealias(id);
10010
21902
ALTER TABLE ONLY messagechunk
10011
21903
ADD CONSTRAINT messagechunk_blob_fk FOREIGN KEY (blob) REFERENCES libraryfilealias(id);
10013
21906
ALTER TABLE ONLY messagechunk
10014
21907
ADD CONSTRAINT messagechunk_message_fk FOREIGN KEY (message) REFERENCES message(id);
10016
21910
ALTER TABLE ONLY milestone
10017
21911
ADD CONSTRAINT milestone__distroseries__distribution__fk FOREIGN KEY (distroseries, distribution) REFERENCES distroseries(id, distribution);
10019
21914
ALTER TABLE ONLY milestone
10020
21915
ADD CONSTRAINT milestone__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10022
21918
ALTER TABLE ONLY milestone
10023
21919
ADD CONSTRAINT milestone_distribution_fk FOREIGN KEY (distribution) REFERENCES distribution(id);
10025
21922
ALTER TABLE ONLY milestone
10026
21923
ADD CONSTRAINT milestone_product_fk FOREIGN KEY (product) REFERENCES product(id);
10028
21926
ALTER TABLE ONLY milestone
10029
21927
ADD CONSTRAINT milestone_product_series_fk FOREIGN KEY (product, productseries) REFERENCES productseries(product, id);
10031
21930
ALTER TABLE ONLY milestone
10032
21931
ADD CONSTRAINT milestone_productseries_fk FOREIGN KEY (productseries) REFERENCES productseries(id);
10034
21934
ALTER TABLE ONLY mirror
10035
21935
ADD CONSTRAINT mirror_country_fk FOREIGN KEY (country) REFERENCES country(id);
10037
21938
ALTER TABLE ONLY mirror
10038
21939
ADD CONSTRAINT mirror_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10040
21942
ALTER TABLE ONLY mirrorcdimagedistroseries
10041
21943
ADD CONSTRAINT mirrorcdimagedistroseries__distribution_mirror__fk FOREIGN KEY (distribution_mirror) REFERENCES distributionmirror(id);
10043
21946
ALTER TABLE ONLY mirrorcdimagedistroseries
10044
21947
ADD CONSTRAINT mirrorcdimagedistroseries__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10046
21950
ALTER TABLE ONLY mirrorcontent
10047
21951
ADD CONSTRAINT mirrorcontent__distroarchseries__fk FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
10049
21954
ALTER TABLE ONLY mirrorcontent
10050
21955
ADD CONSTRAINT mirrorcontent_component_fk FOREIGN KEY (component) REFERENCES component(id);
10052
21958
ALTER TABLE ONLY mirrorcontent
10053
21959
ADD CONSTRAINT mirrorcontent_mirror_fk FOREIGN KEY (mirror) REFERENCES mirror(id);
10055
21962
ALTER TABLE ONLY mirrordistroarchseries
10056
21963
ADD CONSTRAINT mirrordistroarchseries__component__fk FOREIGN KEY (component) REFERENCES component(id);
10058
21966
ALTER TABLE ONLY mirrordistroarchseries
10059
21967
ADD CONSTRAINT mirrordistroarchseries__distribution_mirror__fk FOREIGN KEY (distribution_mirror) REFERENCES distributionmirror(id);
10061
21970
ALTER TABLE ONLY mirrordistroarchseries
10062
21971
ADD CONSTRAINT mirrordistroarchseries__distroarchseries__fk FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
10064
21974
ALTER TABLE ONLY mirrordistroseriessource
10065
21975
ADD CONSTRAINT mirrordistroseriessource__component__fk FOREIGN KEY (component) REFERENCES component(id);
10067
21978
ALTER TABLE ONLY mirrordistroseriessource
10068
21979
ADD CONSTRAINT mirrordistroseriessource__distribution_mirror__fk FOREIGN KEY (distribution_mirror) REFERENCES distributionmirror(id);
10070
21982
ALTER TABLE ONLY mirrordistroseriessource
10071
21983
ADD CONSTRAINT mirrordistroseriessource__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10073
21986
ALTER TABLE ONLY mirrorproberecord
10074
21987
ADD CONSTRAINT mirrorproberecord_distribution_mirror_fkey FOREIGN KEY (distribution_mirror) REFERENCES distributionmirror(id);
10076
21990
ALTER TABLE ONLY mirrorproberecord
10077
21991
ADD CONSTRAINT mirrorproberecord_log_file_fkey FOREIGN KEY (log_file) REFERENCES libraryfilealias(id);
10079
21994
ALTER TABLE ONLY mirrorsourcecontent
10080
21995
ADD CONSTRAINT mirrorsourcecontent__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10082
21998
ALTER TABLE ONLY mirrorsourcecontent
10083
21999
ADD CONSTRAINT mirrorsourcecontent_component_fk FOREIGN KEY (component) REFERENCES component(id);
10085
22002
ALTER TABLE ONLY mirrorsourcecontent
10086
22003
ADD CONSTRAINT mirrorsourcecontent_mirror_fk FOREIGN KEY (mirror) REFERENCES mirror(id);
22006
ALTER TABLE ONLY nameblacklist
22007
ADD CONSTRAINT nameblacklist_admin_fk FOREIGN KEY (admin) REFERENCES person(id);
22010
ALTER TABLE ONLY incrementaldiff
22011
ADD CONSTRAINT new_revision_fk FOREIGN KEY (new_revision) REFERENCES revision(id) ON DELETE CASCADE;
10088
22014
ALTER TABLE ONLY oauthaccesstoken
10089
22015
ADD CONSTRAINT oauthaccesstoken_consumer_fkey FOREIGN KEY (consumer) REFERENCES oauthconsumer(id);
10091
22018
ALTER TABLE ONLY oauthaccesstoken
10092
22019
ADD CONSTRAINT oauthaccesstoken_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
10094
22022
ALTER TABLE ONLY oauthaccesstoken
10095
22023
ADD CONSTRAINT oauthaccesstoken_person_fkey FOREIGN KEY (person) REFERENCES person(id);
10097
22026
ALTER TABLE ONLY oauthaccesstoken
10098
22027
ADD CONSTRAINT oauthaccesstoken_product_fkey FOREIGN KEY (product) REFERENCES product(id);
10100
22030
ALTER TABLE ONLY oauthaccesstoken
10101
22031
ADD CONSTRAINT oauthaccesstoken_project_fkey FOREIGN KEY (project) REFERENCES project(id);
10103
22034
ALTER TABLE ONLY oauthaccesstoken
10104
22035
ADD CONSTRAINT oauthaccesstoken_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10106
22038
ALTER TABLE ONLY oauthnonce
10107
22039
ADD CONSTRAINT oauthnonce__access_token__fk FOREIGN KEY (access_token) REFERENCES oauthaccesstoken(id) ON DELETE CASCADE;
10109
22042
ALTER TABLE ONLY oauthrequesttoken
10110
22043
ADD CONSTRAINT oauthrequesttoken_consumer_fkey FOREIGN KEY (consumer) REFERENCES oauthconsumer(id);
10112
22046
ALTER TABLE ONLY oauthrequesttoken
10113
22047
ADD CONSTRAINT oauthrequesttoken_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
10115
22050
ALTER TABLE ONLY oauthrequesttoken
10116
22051
ADD CONSTRAINT oauthrequesttoken_person_fkey FOREIGN KEY (person) REFERENCES person(id);
10118
22054
ALTER TABLE ONLY oauthrequesttoken
10119
22055
ADD CONSTRAINT oauthrequesttoken_product_fkey FOREIGN KEY (product) REFERENCES product(id);
10121
22058
ALTER TABLE ONLY oauthrequesttoken
10122
22059
ADD CONSTRAINT oauthrequesttoken_project_fkey FOREIGN KEY (project) REFERENCES project(id);
10124
22062
ALTER TABLE ONLY oauthrequesttoken
10125
22063
ADD CONSTRAINT oauthrequesttoken_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10127
22066
ALTER TABLE ONLY officialbugtag
10128
22067
ADD CONSTRAINT officialbugtag_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
10130
22070
ALTER TABLE ONLY officialbugtag
10131
22071
ADD CONSTRAINT officialbugtag_product_fkey FOREIGN KEY (product) REFERENCES product(id);
10133
22074
ALTER TABLE ONLY officialbugtag
10134
22075
ADD CONSTRAINT officialbugtag_project_fkey FOREIGN KEY (project) REFERENCES project(id);
10136
ALTER TABLE ONLY openidrpconfig
10137
ADD CONSTRAINT openidrpconfig__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
10139
ALTER TABLE ONLY openidrpsummary
10140
ADD CONSTRAINT openidrpsummary_account_fkey FOREIGN KEY (account) REFERENCES account(id);
10142
ALTER TABLE ONLY packagebugsupervisor
10143
ADD CONSTRAINT packagebugsupervisor__bug_supervisor__fk FOREIGN KEY (bug_supervisor) REFERENCES person(id);
22078
ALTER TABLE ONLY incrementaldiff
22079
ADD CONSTRAINT old_revision_fk FOREIGN KEY (old_revision) REFERENCES revision(id) ON DELETE CASCADE;
22082
ALTER TABLE ONLY openididentifier
22083
ADD CONSTRAINT openididentifier_account_fkey FOREIGN KEY (account) REFERENCES account(id) ON DELETE CASCADE;
10145
22086
ALTER TABLE ONLY packagebuild
10146
22087
ADD CONSTRAINT packagebuild__archive__fk FOREIGN KEY (archive) REFERENCES archive(id);
10148
22090
ALTER TABLE ONLY packagebuild
10149
22091
ADD CONSTRAINT packagebuild__build_farm_job__fk FOREIGN KEY (build_farm_job) REFERENCES buildfarmjob(id);
10151
22094
ALTER TABLE ONLY packagebuild
10152
22095
ADD CONSTRAINT packagebuild__log__fk FOREIGN KEY (upload_log) REFERENCES libraryfilealias(id);
22098
ALTER TABLE ONLY packagecopyjob
22099
ADD CONSTRAINT packagecopyjob__job__fk FOREIGN KEY (job) REFERENCES job(id);
22102
ALTER TABLE ONLY packagecopyjob
22103
ADD CONSTRAINT packagecopyjob_source_archive_fkey FOREIGN KEY (source_archive) REFERENCES archive(id);
22106
ALTER TABLE ONLY packagecopyjob
22107
ADD CONSTRAINT packagecopyjob_target_archive_fkey FOREIGN KEY (target_archive) REFERENCES archive(id);
22110
ALTER TABLE ONLY packagecopyjob
22111
ADD CONSTRAINT packagecopyjob_target_distroseries_fkey FOREIGN KEY (target_distroseries) REFERENCES distroseries(id);
10154
22114
ALTER TABLE ONLY packagecopyrequest
10155
22115
ADD CONSTRAINT packagecopyrequest__sourcearchive__fk FOREIGN KEY (source_archive) REFERENCES archive(id) ON DELETE CASCADE;
10157
22118
ALTER TABLE ONLY packagecopyrequest
10158
22119
ADD CONSTRAINT packagecopyrequest__targetarchive__fk FOREIGN KEY (target_archive) REFERENCES archive(id) ON DELETE CASCADE;
10160
22122
ALTER TABLE ONLY packagecopyrequest
10161
22123
ADD CONSTRAINT packagecopyrequest_requester_fk FOREIGN KEY (requester) REFERENCES person(id);
10163
22126
ALTER TABLE ONLY packagecopyrequest
10164
22127
ADD CONSTRAINT packagecopyrequest_sourcecomponent_fk FOREIGN KEY (source_component) REFERENCES component(id);
10166
22130
ALTER TABLE ONLY packagecopyrequest
10167
22131
ADD CONSTRAINT packagecopyrequest_sourcedistroseries_fk FOREIGN KEY (source_distroseries) REFERENCES distroseries(id);
10169
22134
ALTER TABLE ONLY packagecopyrequest
10170
22135
ADD CONSTRAINT packagecopyrequest_targetcomponent_fk FOREIGN KEY (target_component) REFERENCES component(id);
10172
22138
ALTER TABLE ONLY packagecopyrequest
10173
22139
ADD CONSTRAINT packagecopyrequest_targetdistroseries_fk FOREIGN KEY (target_distroseries) REFERENCES distroseries(id);
10175
22142
ALTER TABLE ONLY packagediff
10176
22143
ADD CONSTRAINT packagediff_diff_content_fkey FOREIGN KEY (diff_content) REFERENCES libraryfilealias(id);
10178
22146
ALTER TABLE ONLY packagediff
10179
22147
ADD CONSTRAINT packagediff_from_source_fkey FOREIGN KEY (from_source) REFERENCES sourcepackagerelease(id);
10181
22150
ALTER TABLE ONLY packagediff
10182
22151
ADD CONSTRAINT packagediff_requester_fkey FOREIGN KEY (requester) REFERENCES person(id);
10184
22154
ALTER TABLE ONLY packagediff
10185
22155
ADD CONSTRAINT packagediff_to_source_fkey FOREIGN KEY (to_source) REFERENCES sourcepackagerelease(id);
10187
ALTER TABLE ONLY packageselection
10188
ADD CONSTRAINT packageselection__binarypackagename__fk FOREIGN KEY (binarypackagename) REFERENCES binarypackagename(id);
10190
ALTER TABLE ONLY packageselection
10191
ADD CONSTRAINT packageselection__component__fk FOREIGN KEY (component) REFERENCES component(id);
10193
ALTER TABLE ONLY packageselection
10194
ADD CONSTRAINT packageselection__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10196
ALTER TABLE ONLY packageselection
10197
ADD CONSTRAINT packageselection__section__fk FOREIGN KEY (section) REFERENCES section(id);
10199
ALTER TABLE ONLY packageselection
10200
ADD CONSTRAINT packageselection__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10202
22158
ALTER TABLE ONLY packageset
10203
22159
ADD CONSTRAINT packageset__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10205
22162
ALTER TABLE ONLY packageset
10206
22163
ADD CONSTRAINT packageset__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
10208
22166
ALTER TABLE ONLY packageset
10209
22167
ADD CONSTRAINT packageset__packagesetgroup__fk FOREIGN KEY (packagesetgroup) REFERENCES packagesetgroup(id);
10211
22170
ALTER TABLE ONLY packagesetgroup
10212
22171
ADD CONSTRAINT packagesetgroup__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
10214
22174
ALTER TABLE ONLY packagesetinclusion
10215
22175
ADD CONSTRAINT packagesetinclusion__child__fk FOREIGN KEY (child) REFERENCES packageset(id);
10217
22178
ALTER TABLE ONLY packagesetinclusion
10218
22179
ADD CONSTRAINT packagesetinclusion__parent__fk FOREIGN KEY (parent) REFERENCES packageset(id);
10220
22182
ALTER TABLE ONLY packagesetsources
10221
22183
ADD CONSTRAINT packagesetsources__packageset__fk FOREIGN KEY (packageset) REFERENCES packageset(id);
10223
22186
ALTER TABLE ONLY packageupload
10224
22187
ADD CONSTRAINT packageupload__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
10226
22190
ALTER TABLE ONLY packageupload
10227
22191
ADD CONSTRAINT packageupload__changesfile__fk FOREIGN KEY (changesfile) REFERENCES libraryfilealias(id);
10229
22194
ALTER TABLE ONLY packageupload
10230
22195
ADD CONSTRAINT packageupload__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22198
ALTER TABLE ONLY packageupload
22199
ADD CONSTRAINT packageupload__package_copy_job__fk FOREIGN KEY (package_copy_job) REFERENCES packagecopyjob(id);
10232
22202
ALTER TABLE ONLY packageupload
10233
22203
ADD CONSTRAINT packageupload__signing_key__fk FOREIGN KEY (signing_key) REFERENCES gpgkey(id);
10235
22206
ALTER TABLE ONLY packageuploadbuild
10236
22207
ADD CONSTRAINT packageuploadbuild__packageupload__fk FOREIGN KEY (packageupload) REFERENCES packageupload(id) ON DELETE CASCADE;
10238
22210
ALTER TABLE ONLY packageuploadbuild
10239
22211
ADD CONSTRAINT packageuploadbuild_build_fk FOREIGN KEY (build) REFERENCES binarypackagebuild(id);
10241
22214
ALTER TABLE ONLY packageuploadcustom
10242
22215
ADD CONSTRAINT packageuploadcustom_libraryfilealias_fk FOREIGN KEY (libraryfilealias) REFERENCES libraryfilealias(id);
10244
22218
ALTER TABLE ONLY packageuploadcustom
10245
22219
ADD CONSTRAINT packageuploadcustom_packageupload_fk FOREIGN KEY (packageupload) REFERENCES packageupload(id);
10247
22222
ALTER TABLE ONLY packageuploadsource
10248
22223
ADD CONSTRAINT packageuploadsource__packageupload__fk FOREIGN KEY (packageupload) REFERENCES packageupload(id) ON DELETE CASCADE;
10250
22226
ALTER TABLE ONLY packageuploadsource
10251
22227
ADD CONSTRAINT packageuploadsource__sourcepackagerelease__fk FOREIGN KEY (sourcepackagerelease) REFERENCES sourcepackagerelease(id);
10253
22230
ALTER TABLE ONLY packaging
10254
22231
ADD CONSTRAINT packaging__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10256
22234
ALTER TABLE ONLY packaging
10257
22235
ADD CONSTRAINT packaging_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10259
22238
ALTER TABLE ONLY packaging
10260
22239
ADD CONSTRAINT packaging_productseries_fk FOREIGN KEY (productseries) REFERENCES productseries(id);
10262
22242
ALTER TABLE ONLY packaging
10263
22243
ADD CONSTRAINT packaging_sourcepackagename_fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10265
22246
ALTER TABLE ONLY person
10266
22247
ADD CONSTRAINT person__account__fk FOREIGN KEY (account) REFERENCES account(id);
10268
22250
ALTER TABLE ONLY person
10269
22251
ADD CONSTRAINT person__icon__fk FOREIGN KEY (icon) REFERENCES libraryfilealias(id);
10271
22254
ALTER TABLE ONLY person
10272
22255
ADD CONSTRAINT person__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
10274
22258
ALTER TABLE ONLY person
10275
22259
ADD CONSTRAINT person__mugshot__fk FOREIGN KEY (mugshot) REFERENCES libraryfilealias(id);
10277
22262
ALTER TABLE ONLY karmacache
10278
22263
ADD CONSTRAINT person_fk FOREIGN KEY (person) REFERENCES person(id);
10280
22266
ALTER TABLE ONLY person
10281
22267
ADD CONSTRAINT person_language_fk FOREIGN KEY (language) REFERENCES language(id);
10283
22270
ALTER TABLE ONLY person
10284
22271
ADD CONSTRAINT person_merged_fk FOREIGN KEY (merged) REFERENCES person(id);
10286
22274
ALTER TABLE ONLY person
10287
22275
ADD CONSTRAINT person_registrant_fk FOREIGN KEY (registrant) REFERENCES person(id);
10289
22278
ALTER TABLE ONLY person
10290
22279
ADD CONSTRAINT person_teamowner_fk FOREIGN KEY (teamowner) REFERENCES person(id);
10292
22282
ALTER TABLE ONLY personlanguage
10293
22283
ADD CONSTRAINT personlanguage_language_fk FOREIGN KEY (language) REFERENCES language(id);
10295
22286
ALTER TABLE ONLY personlanguage
10296
22287
ADD CONSTRAINT personlanguage_person_fk FOREIGN KEY (person) REFERENCES person(id);
10298
22290
ALTER TABLE ONLY personlocation
10299
22291
ADD CONSTRAINT personlocation_last_modified_by_fkey FOREIGN KEY (last_modified_by) REFERENCES person(id);
10301
22294
ALTER TABLE ONLY personlocation
10302
22295
ADD CONSTRAINT personlocation_person_fkey FOREIGN KEY (person) REFERENCES person(id);
10304
22298
ALTER TABLE ONLY personnotification
10305
22299
ADD CONSTRAINT personnotification_person_fkey FOREIGN KEY (person) REFERENCES person(id);
22302
ALTER TABLE ONLY personsettings
22303
ADD CONSTRAINT personsettings_person_fkey FOREIGN KEY (person) REFERENCES person(id) ON DELETE CASCADE;
22306
ALTER TABLE ONLY persontransferjob
22307
ADD CONSTRAINT persontransferjob_job_fkey FOREIGN KEY (job) REFERENCES job(id);
22310
ALTER TABLE ONLY persontransferjob
22311
ADD CONSTRAINT persontransferjob_major_person_fkey FOREIGN KEY (major_person) REFERENCES person(id);
22314
ALTER TABLE ONLY persontransferjob
22315
ADD CONSTRAINT persontransferjob_minor_person_fkey FOREIGN KEY (minor_person) REFERENCES person(id);
10307
22318
ALTER TABLE ONLY pillarname
10308
22319
ADD CONSTRAINT pillarname__alias_for__fk FOREIGN KEY (alias_for) REFERENCES pillarname(id);
10310
22322
ALTER TABLE ONLY pillarname
10311
22323
ADD CONSTRAINT pillarname_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id) ON DELETE CASCADE;
10313
22326
ALTER TABLE ONLY pillarname
10314
22327
ADD CONSTRAINT pillarname_product_fkey FOREIGN KEY (product) REFERENCES product(id) ON DELETE CASCADE;
10316
22330
ALTER TABLE ONLY pillarname
10317
22331
ADD CONSTRAINT pillarname_project_fkey FOREIGN KEY (project) REFERENCES project(id) ON DELETE CASCADE;
10319
22334
ALTER TABLE ONLY pocketchroot
10320
22335
ADD CONSTRAINT pocketchroot__distroarchseries__fk FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
10322
22338
ALTER TABLE ONLY pocketchroot
10323
22339
ADD CONSTRAINT pocketchroot__libraryfilealias__fk FOREIGN KEY (chroot) REFERENCES libraryfilealias(id);
10325
22342
ALTER TABLE ONLY poexportrequest
10326
22343
ADD CONSTRAINT poeportrequest_potemplate_fk FOREIGN KEY (potemplate) REFERENCES potemplate(id);
10328
22346
ALTER TABLE ONLY poexportrequest
10329
22347
ADD CONSTRAINT poexportrequest_person_fk FOREIGN KEY (person) REFERENCES person(id);
10331
22350
ALTER TABLE ONLY poexportrequest
10332
22351
ADD CONSTRAINT poexportrequest_pofile_fk FOREIGN KEY (pofile) REFERENCES pofile(id);
10334
22354
ALTER TABLE ONLY pofile
10335
22355
ADD CONSTRAINT pofile_language_fk FOREIGN KEY (language) REFERENCES language(id);
10337
22358
ALTER TABLE ONLY pofile
10338
22359
ADD CONSTRAINT pofile_lasttranslator_fk FOREIGN KEY (lasttranslator) REFERENCES person(id);
10340
22362
ALTER TABLE ONLY pofile
10341
22363
ADD CONSTRAINT pofile_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10343
22366
ALTER TABLE ONLY pofile
10344
22367
ADD CONSTRAINT pofile_potemplate_fk FOREIGN KEY (potemplate) REFERENCES potemplate(id);
22370
ALTER TABLE ONLY pofilestatsjob
22371
ADD CONSTRAINT pofilestatsjob_job_fkey FOREIGN KEY (job) REFERENCES job(id);
22374
ALTER TABLE ONLY pofilestatsjob
22375
ADD CONSTRAINT pofilestatsjob_pofile_fkey FOREIGN KEY (pofile) REFERENCES pofile(id);
10346
22378
ALTER TABLE ONLY pofiletranslator
10347
22379
ADD CONSTRAINT pofiletranslator__latest_message__fk FOREIGN KEY (latest_message) REFERENCES translationmessage(id) DEFERRABLE INITIALLY DEFERRED;
10349
22382
ALTER TABLE ONLY pofiletranslator
10350
22383
ADD CONSTRAINT pofiletranslator__person__fk FOREIGN KEY (person) REFERENCES person(id);
10352
22386
ALTER TABLE ONLY pofiletranslator
10353
22387
ADD CONSTRAINT pofiletranslator__pofile__fk FOREIGN KEY (pofile) REFERENCES pofile(id);
10355
22390
ALTER TABLE ONLY poll
10356
22391
ADD CONSTRAINT poll_team_fk FOREIGN KEY (team) REFERENCES person(id);
10358
22394
ALTER TABLE ONLY potemplate
10359
22395
ADD CONSTRAINT potemplate__distrorelease__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10361
22398
ALTER TABLE ONLY potemplate
10362
22399
ADD CONSTRAINT potemplate__from_sourcepackagename__fk FOREIGN KEY (from_sourcepackagename) REFERENCES sourcepackagename(id);
10364
22402
ALTER TABLE ONLY potemplate
10365
22403
ADD CONSTRAINT potemplate__source_file__fk FOREIGN KEY (source_file) REFERENCES libraryfilealias(id);
10367
22406
ALTER TABLE ONLY potemplate
10368
22407
ADD CONSTRAINT potemplate_binarypackagename_fk FOREIGN KEY (binarypackagename) REFERENCES binarypackagename(id);
22410
ALTER TABLE ONLY packagingjob
22411
ADD CONSTRAINT potemplate_fk FOREIGN KEY (potemplate) REFERENCES potemplate(id);
10370
22414
ALTER TABLE ONLY potemplate
10371
22415
ADD CONSTRAINT potemplate_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10373
22418
ALTER TABLE ONLY potemplate
10374
22419
ADD CONSTRAINT potemplate_productseries_fk FOREIGN KEY (productseries) REFERENCES productseries(id);
10376
22422
ALTER TABLE ONLY potemplate
10377
22423
ADD CONSTRAINT potemplate_sourcepackagename_fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10379
22426
ALTER TABLE ONLY potmsgset
10380
22427
ADD CONSTRAINT potmsgset__msgid_plural__fk FOREIGN KEY (msgid_plural) REFERENCES pomsgid(id);
10382
22430
ALTER TABLE ONLY potmsgset
10383
22431
ADD CONSTRAINT potmsgset_potemplate_fk FOREIGN KEY (potemplate) REFERENCES potemplate(id);
10385
22434
ALTER TABLE ONLY potmsgset
10386
22435
ADD CONSTRAINT potmsgset_primemsgid_fk FOREIGN KEY (msgid_singular) REFERENCES pomsgid(id);
10388
22438
ALTER TABLE ONLY previewdiff
10389
22439
ADD CONSTRAINT previewdiff_diff_fkey FOREIGN KEY (diff) REFERENCES diff(id) ON DELETE CASCADE;
10391
22442
ALTER TABLE ONLY product
10392
22443
ADD CONSTRAINT product__development_focus__fk FOREIGN KEY (development_focus) REFERENCES productseries(id);
10394
22446
ALTER TABLE ONLY product
10395
22447
ADD CONSTRAINT product__icon__fk FOREIGN KEY (icon) REFERENCES libraryfilealias(id);
10397
22450
ALTER TABLE ONLY product
10398
22451
ADD CONSTRAINT product__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
10400
22454
ALTER TABLE ONLY product
10401
22455
ADD CONSTRAINT product__mugshot__fk FOREIGN KEY (mugshot) REFERENCES libraryfilealias(id);
10403
22458
ALTER TABLE ONLY product
10404
22459
ADD CONSTRAINT product__translation_focus__fk FOREIGN KEY (translation_focus) REFERENCES productseries(id);
10406
22462
ALTER TABLE ONLY product
10407
22463
ADD CONSTRAINT product_bugtracker_fkey FOREIGN KEY (bugtracker) REFERENCES bugtracker(id);
10409
22466
ALTER TABLE ONLY product
10410
22467
ADD CONSTRAINT product_driver_fk FOREIGN KEY (driver) REFERENCES person(id);
10412
22470
ALTER TABLE ONLY product
10413
22471
ADD CONSTRAINT product_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10415
22474
ALTER TABLE ONLY product
10416
22475
ADD CONSTRAINT product_project_fk FOREIGN KEY (project) REFERENCES project(id);
10418
22478
ALTER TABLE ONLY product
10419
22479
ADD CONSTRAINT product_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
10421
22482
ALTER TABLE ONLY product
10422
22483
ADD CONSTRAINT product_security_contact_fkey FOREIGN KEY (security_contact) REFERENCES person(id);
10424
22486
ALTER TABLE ONLY product
10425
22487
ADD CONSTRAINT product_translationgroup_fk FOREIGN KEY (translationgroup) REFERENCES translationgroup(id);
10427
ALTER TABLE ONLY productbounty
10428
ADD CONSTRAINT productbounty_bounty_fk FOREIGN KEY (bounty) REFERENCES bounty(id);
10430
ALTER TABLE ONLY productbounty
10431
ADD CONSTRAINT productbounty_product_fk FOREIGN KEY (product) REFERENCES product(id);
10433
ALTER TABLE ONLY productcvsmodule
10434
ADD CONSTRAINT productcvsmodule_product_fk FOREIGN KEY (product) REFERENCES product(id);
10436
22490
ALTER TABLE ONLY productlicense
10437
22491
ADD CONSTRAINT productlicense_product_fkey FOREIGN KEY (product) REFERENCES product(id);
10439
22494
ALTER TABLE ONLY productrelease
10440
22495
ADD CONSTRAINT productrelease_milestone_fkey FOREIGN KEY (milestone) REFERENCES milestone(id);
10442
22498
ALTER TABLE ONLY productrelease
10443
22499
ADD CONSTRAINT productrelease_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10445
22502
ALTER TABLE ONLY productreleasefile
10446
22503
ADD CONSTRAINT productreleasefile__signature__fk FOREIGN KEY (signature) REFERENCES libraryfilealias(id);
10448
22506
ALTER TABLE ONLY productreleasefile
10449
22507
ADD CONSTRAINT productreleasefile__uploader__fk FOREIGN KEY (uploader) REFERENCES person(id);
10451
22510
ALTER TABLE ONLY productseries
10452
22511
ADD CONSTRAINT productseries_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
10454
22514
ALTER TABLE ONLY productseries
10455
22515
ADD CONSTRAINT productseries_driver_fk FOREIGN KEY (driver) REFERENCES person(id);
22518
ALTER TABLE ONLY packagingjob
22519
ADD CONSTRAINT productseries_fk FOREIGN KEY (productseries) REFERENCES productseries(id);
10457
22522
ALTER TABLE ONLY productseries
10458
22523
ADD CONSTRAINT productseries_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10460
22526
ALTER TABLE ONLY productseries
10461
22527
ADD CONSTRAINT productseries_product_fk FOREIGN KEY (product) REFERENCES product(id);
10463
22530
ALTER TABLE ONLY productseries
10464
22531
ADD CONSTRAINT productseries_translations_branch_fkey FOREIGN KEY (translations_branch) REFERENCES branch(id);
10466
ALTER TABLE ONLY productseriescodeimport
10467
ADD CONSTRAINT productseriescodeimport_codeimport_fkey FOREIGN KEY (codeimport) REFERENCES codeimport(id);
10469
ALTER TABLE ONLY productseriescodeimport
10470
ADD CONSTRAINT productseriescodeimport_productseries_fkey FOREIGN KEY (productseries) REFERENCES productseries(id);
10472
ALTER TABLE ONLY productsvnmodule
10473
ADD CONSTRAINT productsvnmodule_product_fk FOREIGN KEY (product) REFERENCES product(id);
10475
22534
ALTER TABLE ONLY project
10476
22535
ADD CONSTRAINT project__icon__fk FOREIGN KEY (icon) REFERENCES libraryfilealias(id);
10478
22538
ALTER TABLE ONLY project
10479
22539
ADD CONSTRAINT project__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
10481
22542
ALTER TABLE ONLY project
10482
22543
ADD CONSTRAINT project__mugshot__fk FOREIGN KEY (mugshot) REFERENCES libraryfilealias(id);
10484
22546
ALTER TABLE ONLY project
10485
22547
ADD CONSTRAINT project_bugtracker_fkey FOREIGN KEY (bugtracker) REFERENCES bugtracker(id);
10487
22550
ALTER TABLE ONLY project
10488
22551
ADD CONSTRAINT project_driver_fk FOREIGN KEY (driver) REFERENCES person(id);
10490
22554
ALTER TABLE ONLY project
10491
22555
ADD CONSTRAINT project_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10493
22558
ALTER TABLE ONLY project
10494
22559
ADD CONSTRAINT project_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
10496
22562
ALTER TABLE ONLY project
10497
22563
ADD CONSTRAINT project_translationgroup_fk FOREIGN KEY (translationgroup) REFERENCES translationgroup(id);
10499
ALTER TABLE ONLY projectbounty
10500
ADD CONSTRAINT projectbounty_bounty_fk FOREIGN KEY (bounty) REFERENCES bounty(id);
10502
ALTER TABLE ONLY projectbounty
10503
ADD CONSTRAINT projectbounty_project_fk FOREIGN KEY (project) REFERENCES project(id);
10505
ALTER TABLE ONLY projectrelationship
10506
ADD CONSTRAINT projectrelationship_object_fk FOREIGN KEY (object) REFERENCES project(id);
10508
ALTER TABLE ONLY projectrelationship
10509
ADD CONSTRAINT projectrelationship_subject_fk FOREIGN KEY (subject) REFERENCES project(id);
22566
ALTER TABLE ONLY publisherconfig
22567
ADD CONSTRAINT publisherconfig__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
10511
22570
ALTER TABLE ONLY question
10512
22571
ADD CONSTRAINT question__answer__fk FOREIGN KEY (answer) REFERENCES questionmessage(id);
10514
22574
ALTER TABLE ONLY question
10515
22575
ADD CONSTRAINT question__answerer__fk FOREIGN KEY (answerer) REFERENCES person(id);
10517
22578
ALTER TABLE ONLY question
10518
22579
ADD CONSTRAINT question__assignee__fk FOREIGN KEY (assignee) REFERENCES person(id);
10520
22582
ALTER TABLE ONLY question
10521
22583
ADD CONSTRAINT question__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
10523
22586
ALTER TABLE ONLY question
10524
22587
ADD CONSTRAINT question__faq__fk FOREIGN KEY (faq) REFERENCES faq(id);
10526
22590
ALTER TABLE ONLY question
10527
22591
ADD CONSTRAINT question__language__fkey FOREIGN KEY (language) REFERENCES language(id);
10529
22594
ALTER TABLE ONLY question
10530
22595
ADD CONSTRAINT question__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
10532
22598
ALTER TABLE ONLY question
10533
22599
ADD CONSTRAINT question__product__fk FOREIGN KEY (product) REFERENCES product(id);
10535
22602
ALTER TABLE ONLY question
10536
22603
ADD CONSTRAINT question__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10538
22606
ALTER TABLE ONLY questionbug
10539
22607
ADD CONSTRAINT questionbug__bug__fk FOREIGN KEY (bug) REFERENCES bug(id);
10541
22610
ALTER TABLE ONLY questionbug
10542
22611
ADD CONSTRAINT questionbug__question__fk FOREIGN KEY (question) REFERENCES question(id);
22614
ALTER TABLE ONLY questionjob
22615
ADD CONSTRAINT questionjob_job_fkey FOREIGN KEY (job) REFERENCES job(id);
22618
ALTER TABLE ONLY questionjob
22619
ADD CONSTRAINT questionjob_question_fkey FOREIGN KEY (question) REFERENCES question(id);
10544
22622
ALTER TABLE ONLY questionmessage
10545
22623
ADD CONSTRAINT questionmessage__message__fk FOREIGN KEY (message) REFERENCES message(id);
10547
22626
ALTER TABLE ONLY questionmessage
10548
22627
ADD CONSTRAINT questionmessage__question__fk FOREIGN KEY (question) REFERENCES question(id);
10550
22630
ALTER TABLE ONLY questionreopening
10551
22631
ADD CONSTRAINT questionreopening__answerer__fk FOREIGN KEY (answerer) REFERENCES person(id);
10553
22634
ALTER TABLE ONLY questionreopening
10554
22635
ADD CONSTRAINT questionreopening__question__fk FOREIGN KEY (question) REFERENCES question(id);
10556
22638
ALTER TABLE ONLY questionreopening
10557
22639
ADD CONSTRAINT questionreopening__reopener__fk FOREIGN KEY (reopener) REFERENCES person(id);
10559
22642
ALTER TABLE ONLY questionsubscription
10560
22643
ADD CONSTRAINT questionsubscription__person__fk FOREIGN KEY (person) REFERENCES person(id);
10562
22646
ALTER TABLE ONLY questionsubscription
10563
22647
ADD CONSTRAINT questionsubscription__question__fk FOREIGN KEY (question) REFERENCES question(id);
10565
ALTER TABLE ONLY requestedcds
10566
ADD CONSTRAINT requestedcds_request_fk FOREIGN KEY (request) REFERENCES shippingrequest(id);
10568
22650
ALTER TABLE ONLY teammembership
10569
22651
ADD CONSTRAINT reviewer_fk FOREIGN KEY (last_changed_by) REFERENCES person(id);
10571
22654
ALTER TABLE ONLY revision
10572
22655
ADD CONSTRAINT revision_gpgkey_fk FOREIGN KEY (gpgkey) REFERENCES gpgkey(id);
10574
22658
ALTER TABLE ONLY revision
10575
22659
ADD CONSTRAINT revision_revision_author_fk FOREIGN KEY (revision_author) REFERENCES revisionauthor(id);
10577
22662
ALTER TABLE ONLY revisionauthor
10578
22663
ADD CONSTRAINT revisionauthor_person_fkey FOREIGN KEY (person) REFERENCES person(id);
10580
22666
ALTER TABLE ONLY revisioncache
10581
22667
ADD CONSTRAINT revisioncache__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10583
22670
ALTER TABLE ONLY revisioncache
10584
22671
ADD CONSTRAINT revisioncache__product__fk FOREIGN KEY (product) REFERENCES product(id);
10586
22674
ALTER TABLE ONLY revisioncache
10587
22675
ADD CONSTRAINT revisioncache__revision__fk FOREIGN KEY (revision) REFERENCES revision(id);
10589
22678
ALTER TABLE ONLY revisioncache
10590
22679
ADD CONSTRAINT revisioncache__revision_author__fk FOREIGN KEY (revision_author) REFERENCES revisionauthor(id);
10592
22682
ALTER TABLE ONLY revisioncache
10593
22683
ADD CONSTRAINT revisioncache__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10595
22686
ALTER TABLE ONLY revisionparent
10596
22687
ADD CONSTRAINT revisionparent_revision_fk FOREIGN KEY (revision) REFERENCES revision(id);
10598
22690
ALTER TABLE ONLY revisionproperty
10599
22691
ADD CONSTRAINT revisionproperty__revision__fk FOREIGN KEY (revision) REFERENCES revision(id);
10601
22694
ALTER TABLE ONLY sectionselection
10602
22695
ADD CONSTRAINT sectionselection__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10604
22698
ALTER TABLE ONLY sectionselection
10605
22699
ADD CONSTRAINT sectionselection__section__fk FOREIGN KEY (section) REFERENCES section(id);
10607
22702
ALTER TABLE ONLY binarypackagepublishinghistory
10608
22703
ADD CONSTRAINT securebinarypackagepublishinghistory__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
10610
22706
ALTER TABLE ONLY binarypackagepublishinghistory
10611
22707
ADD CONSTRAINT securebinarypackagepublishinghistory__distroarchseries__fk FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
10613
22710
ALTER TABLE ONLY binarypackagepublishinghistory
10614
22711
ADD CONSTRAINT securebinarypackagepublishinghistory_binarypackagerelease_fk FOREIGN KEY (binarypackagerelease) REFERENCES binarypackagerelease(id);
10616
22714
ALTER TABLE ONLY binarypackagepublishinghistory
10617
22715
ADD CONSTRAINT securebinarypackagepublishinghistory_component_fk FOREIGN KEY (component) REFERENCES component(id);
10619
22718
ALTER TABLE ONLY binarypackagepublishinghistory
10620
22719
ADD CONSTRAINT securebinarypackagepublishinghistory_removedby_fk FOREIGN KEY (removed_by) REFERENCES person(id);
10622
22722
ALTER TABLE ONLY binarypackagepublishinghistory
10623
22723
ADD CONSTRAINT securebinarypackagepublishinghistory_section_fk FOREIGN KEY (section) REFERENCES section(id);
10625
22726
ALTER TABLE ONLY sourcepackagepublishinghistory
10626
22727
ADD CONSTRAINT securesourcepackagepublishinghistory__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10628
22730
ALTER TABLE ONLY sourcepackagepublishinghistory
10629
22731
ADD CONSTRAINT securesourcepackagepublishinghistory_component_fk FOREIGN KEY (component) REFERENCES component(id);
10631
22734
ALTER TABLE ONLY sourcepackagepublishinghistory
10632
22735
ADD CONSTRAINT securesourcepackagepublishinghistory_removedby_fk FOREIGN KEY (removed_by) REFERENCES person(id);
10634
22738
ALTER TABLE ONLY sourcepackagepublishinghistory
10635
22739
ADD CONSTRAINT securesourcepackagepublishinghistory_section_fk FOREIGN KEY (section) REFERENCES section(id);
10637
22742
ALTER TABLE ONLY sourcepackagepublishinghistory
10638
22743
ADD CONSTRAINT securesourcepackagepublishinghistory_sourcepackagerelease_fk FOREIGN KEY (sourcepackagerelease) REFERENCES sourcepackagerelease(id);
10640
22746
ALTER TABLE ONLY sourcepackagepublishinghistory
10641
22747
ADD CONSTRAINT securesourcepackagepublishinghistory_supersededby_fk FOREIGN KEY (supersededby) REFERENCES sourcepackagerelease(id);
10643
22750
ALTER TABLE ONLY seriessourcepackagebranch
10644
22751
ADD CONSTRAINT seriessourcepackagebranch_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
10646
22754
ALTER TABLE ONLY seriessourcepackagebranch
10647
22755
ADD CONSTRAINT seriessourcepackagebranch_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10649
22758
ALTER TABLE ONLY seriessourcepackagebranch
10650
22759
ADD CONSTRAINT seriessourcepackagebranch_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
10652
22762
ALTER TABLE ONLY seriessourcepackagebranch
10653
22763
ADD CONSTRAINT seriessourcepackagebranch_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10655
ALTER TABLE ONLY shipitsurveyresult
10656
ADD CONSTRAINT shipitsurveyresult_answer_fkey FOREIGN KEY (answer) REFERENCES shipitsurveyanswer(id);
10658
ALTER TABLE ONLY shipitsurveyresult
10659
ADD CONSTRAINT shipitsurveyresult_question_fkey FOREIGN KEY (question) REFERENCES shipitsurveyquestion(id);
10661
ALTER TABLE ONLY shipitsurveyresult
10662
ADD CONSTRAINT shipitsurveyresult_survey_fkey FOREIGN KEY (survey) REFERENCES shipitsurvey(id);
10664
ALTER TABLE ONLY shipment
10665
ADD CONSTRAINT shipment_shippingrun_fk FOREIGN KEY (shippingrun) REFERENCES shippingrun(id);
10667
ALTER TABLE ONLY shippingrequest
10668
ADD CONSTRAINT shippingrequest__country__fk FOREIGN KEY (country) REFERENCES country(id);
10670
ALTER TABLE ONLY shippingrequest
10671
ADD CONSTRAINT shippingrequest_shipment_fk FOREIGN KEY (shipment) REFERENCES shipment(id);
10673
ALTER TABLE ONLY shippingrun
10674
ADD CONSTRAINT shippingrun_csvfile_fk FOREIGN KEY (csvfile) REFERENCES libraryfilealias(id);
10676
22766
ALTER TABLE ONLY signedcodeofconduct
10677
22767
ADD CONSTRAINT signedcodeofconduct_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10679
22770
ALTER TABLE ONLY signedcodeofconduct
10680
22771
ADD CONSTRAINT signedcodeofconduct_signingkey_fk FOREIGN KEY (owner, signingkey) REFERENCES gpgkey(owner, id) ON UPDATE CASCADE;
10682
22774
ALTER TABLE ONLY sourcepackageformatselection
10683
22775
ADD CONSTRAINT sourceformatselection__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22778
ALTER TABLE ONLY packagingjob
22779
ADD CONSTRAINT sourcepackagename_fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10685
22782
ALTER TABLE ONLY packagesetsources
10686
22783
ADD CONSTRAINT sourcepackagenamesources__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10688
22786
ALTER TABLE ONLY sourcepackagepublishinghistory
10689
22787
ADD CONSTRAINT sourcepackagepublishinghistory__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
22790
ALTER TABLE ONLY sourcepackagepublishinghistory
22791
ADD CONSTRAINT sourcepackagepublishinghistory__creator__fk FOREIGN KEY (creator) REFERENCES person(id);
22794
ALTER TABLE ONLY sourcepackagepublishinghistory
22795
ADD CONSTRAINT sourcepackagepublishinghistory_ancestor_fkey FOREIGN KEY (ancestor) REFERENCES sourcepackagepublishinghistory(id);
22798
ALTER TABLE ONLY sourcepackagepublishinghistory
22799
ADD CONSTRAINT sourcepackagepublishinghistory_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10691
22802
ALTER TABLE ONLY sourcepackagerecipe
10692
22803
ADD CONSTRAINT sourcepackagerecipe_daily_build_archive_fkey FOREIGN KEY (daily_build_archive) REFERENCES archive(id);
10694
22806
ALTER TABLE ONLY sourcepackagerecipe
10695
22807
ADD CONSTRAINT sourcepackagerecipe_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
10697
22810
ALTER TABLE ONLY sourcepackagerecipe
10698
22811
ADD CONSTRAINT sourcepackagerecipe_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
10700
22814
ALTER TABLE ONLY sourcepackagerecipebuild
10701
22815
ADD CONSTRAINT sourcepackagerecipebuild_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10703
22818
ALTER TABLE ONLY sourcepackagerecipebuild
10704
22819
ADD CONSTRAINT sourcepackagerecipebuild_manifest_fkey FOREIGN KEY (manifest) REFERENCES sourcepackagerecipedata(id);
10706
22822
ALTER TABLE ONLY sourcepackagerecipebuild
10707
22823
ADD CONSTRAINT sourcepackagerecipebuild_package_build_fkey FOREIGN KEY (package_build) REFERENCES packagebuild(id);
10709
22826
ALTER TABLE ONLY sourcepackagerecipebuild
10710
22827
ADD CONSTRAINT sourcepackagerecipebuild_recipe_fkey FOREIGN KEY (recipe) REFERENCES sourcepackagerecipe(id);
10712
22830
ALTER TABLE ONLY sourcepackagerecipebuild
10713
22831
ADD CONSTRAINT sourcepackagerecipebuild_requester_fkey FOREIGN KEY (requester) REFERENCES person(id);
10715
22834
ALTER TABLE ONLY sourcepackagerecipebuildjob
10716
22835
ADD CONSTRAINT sourcepackagerecipebuildjob_job_fkey FOREIGN KEY (job) REFERENCES job(id);
10718
22838
ALTER TABLE ONLY sourcepackagerecipebuildjob
10719
22839
ADD CONSTRAINT sourcepackagerecipebuildjob_sourcepackage_recipe_build_fkey FOREIGN KEY (sourcepackage_recipe_build) REFERENCES sourcepackagerecipebuild(id);
10721
22842
ALTER TABLE ONLY sourcepackagerecipedata
10722
22843
ADD CONSTRAINT sourcepackagerecipedata_base_branch_fkey FOREIGN KEY (base_branch) REFERENCES branch(id);
10724
22846
ALTER TABLE ONLY sourcepackagerecipedata
10725
22847
ADD CONSTRAINT sourcepackagerecipedata_sourcepackage_recipe_build_fkey FOREIGN KEY (sourcepackage_recipe_build) REFERENCES sourcepackagerecipebuild(id);
10727
22850
ALTER TABLE ONLY sourcepackagerecipedata
10728
22851
ADD CONSTRAINT sourcepackagerecipedata_sourcepackage_recipe_fkey FOREIGN KEY (sourcepackage_recipe) REFERENCES sourcepackagerecipe(id);
10730
22854
ALTER TABLE ONLY sourcepackagerecipedatainstruction
10731
22855
ADD CONSTRAINT sourcepackagerecipedatainstruction_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
10733
22858
ALTER TABLE ONLY sourcepackagerecipedatainstruction
10734
22859
ADD CONSTRAINT sourcepackagerecipedatainstruction_parent_instruction_fkey FOREIGN KEY (parent_instruction) REFERENCES sourcepackagerecipedatainstruction(id);
10736
22862
ALTER TABLE ONLY sourcepackagerecipedatainstruction
10737
22863
ADD CONSTRAINT sourcepackagerecipedatainstruction_recipe_data_fkey FOREIGN KEY (recipe_data) REFERENCES sourcepackagerecipedata(id);
10739
22866
ALTER TABLE ONLY sourcepackagerecipedistroseries
10740
22867
ADD CONSTRAINT sourcepackagerecipedistroseries_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10742
22870
ALTER TABLE ONLY sourcepackagerecipedistroseries
10743
22871
ADD CONSTRAINT sourcepackagerecipedistroseries_sourcepackagerecipe_fkey FOREIGN KEY (sourcepackagerecipe) REFERENCES sourcepackagerecipe(id);
10745
22874
ALTER TABLE ONLY sourcepackagerelease
10746
22875
ADD CONSTRAINT sourcepackagerelease__creator__fk FOREIGN KEY (creator) REFERENCES person(id);
10748
22878
ALTER TABLE ONLY sourcepackagerelease
10749
22879
ADD CONSTRAINT sourcepackagerelease__dscsigningkey FOREIGN KEY (dscsigningkey) REFERENCES gpgkey(id);
10751
22882
ALTER TABLE ONLY sourcepackagerelease
10752
22883
ADD CONSTRAINT sourcepackagerelease__upload_archive__fk FOREIGN KEY (upload_archive) REFERENCES archive(id);
10754
22886
ALTER TABLE ONLY sourcepackagerelease
10755
22887
ADD CONSTRAINT sourcepackagerelease__upload_distroseries__fk FOREIGN KEY (upload_distroseries) REFERENCES distroseries(id);
10757
22890
ALTER TABLE ONLY sourcepackagerelease
10758
22891
ADD CONSTRAINT sourcepackagerelease_changelog_fkey FOREIGN KEY (changelog) REFERENCES libraryfilealias(id);
10760
22894
ALTER TABLE ONLY sourcepackagerelease
10761
22895
ADD CONSTRAINT sourcepackagerelease_component_fk FOREIGN KEY (component) REFERENCES component(id);
10763
22898
ALTER TABLE ONLY sourcepackagerelease
10764
22899
ADD CONSTRAINT sourcepackagerelease_maintainer_fk FOREIGN KEY (maintainer) REFERENCES person(id);
10766
22902
ALTER TABLE ONLY sourcepackagerelease
10767
22903
ADD CONSTRAINT sourcepackagerelease_section FOREIGN KEY (section) REFERENCES section(id);
10769
22906
ALTER TABLE ONLY sourcepackagerelease
10770
22907
ADD CONSTRAINT sourcepackagerelease_sourcepackage_recipe_build_fkey FOREIGN KEY (sourcepackage_recipe_build) REFERENCES sourcepackagerecipebuild(id);
10772
22910
ALTER TABLE ONLY sourcepackagerelease
10773
22911
ADD CONSTRAINT sourcepackagerelease_sourcepackagename_fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10775
22914
ALTER TABLE ONLY specification
10776
22915
ADD CONSTRAINT specification__distroseries__distribution__fk FOREIGN KEY (distroseries, distribution) REFERENCES distroseries(id, distribution);
10778
22918
ALTER TABLE ONLY specification
10779
22919
ADD CONSTRAINT specification_approver_fk FOREIGN KEY (approver) REFERENCES person(id);
10781
22922
ALTER TABLE ONLY specification
10782
22923
ADD CONSTRAINT specification_assignee_fk FOREIGN KEY (assignee) REFERENCES person(id);
10784
22926
ALTER TABLE ONLY specification
10785
22927
ADD CONSTRAINT specification_completer_fkey FOREIGN KEY (completer) REFERENCES person(id);
10787
22930
ALTER TABLE ONLY specification
10788
22931
ADD CONSTRAINT specification_distribution_fk FOREIGN KEY (distribution) REFERENCES distribution(id);
10790
22934
ALTER TABLE ONLY specification
10791
22935
ADD CONSTRAINT specification_distribution_milestone_fk FOREIGN KEY (distribution, milestone) REFERENCES milestone(distribution, id);
10793
22938
ALTER TABLE ONLY specification
10794
22939
ADD CONSTRAINT specification_drafter_fk FOREIGN KEY (drafter) REFERENCES person(id);
10796
22942
ALTER TABLE ONLY specification
10797
22943
ADD CONSTRAINT specification_goal_decider_fkey FOREIGN KEY (goal_decider) REFERENCES person(id);
10799
22946
ALTER TABLE ONLY specification
10800
22947
ADD CONSTRAINT specification_goal_proposer_fkey FOREIGN KEY (goal_proposer) REFERENCES person(id);
10802
22950
ALTER TABLE ONLY specification
10803
22951
ADD CONSTRAINT specification_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10805
22954
ALTER TABLE ONLY specification
10806
22955
ADD CONSTRAINT specification_product_fk FOREIGN KEY (product) REFERENCES product(id);
10808
22958
ALTER TABLE ONLY specification
10809
22959
ADD CONSTRAINT specification_product_milestone_fk FOREIGN KEY (product, milestone) REFERENCES milestone(product, id);
10811
22962
ALTER TABLE ONLY specification
10812
22963
ADD CONSTRAINT specification_productseries_valid FOREIGN KEY (product, productseries) REFERENCES productseries(product, id);
10814
22966
ALTER TABLE ONLY specification
10815
22967
ADD CONSTRAINT specification_starter_fkey FOREIGN KEY (starter) REFERENCES person(id);
10817
22970
ALTER TABLE ONLY specification
10818
22971
ADD CONSTRAINT specification_superseded_by_fk FOREIGN KEY (superseded_by) REFERENCES specification(id);
10820
22974
ALTER TABLE ONLY specificationbranch
10821
22975
ADD CONSTRAINT specificationbranch__branch__fk FOREIGN KEY (branch) REFERENCES branch(id);
10823
22978
ALTER TABLE ONLY specificationbranch
10824
22979
ADD CONSTRAINT specificationbranch__specification__fk FOREIGN KEY (specification) REFERENCES specification(id);
10826
22982
ALTER TABLE ONLY specificationbranch
10827
22983
ADD CONSTRAINT specificationbranch_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
10829
22986
ALTER TABLE ONLY specificationbug
10830
22987
ADD CONSTRAINT specificationbug_bug_fk FOREIGN KEY (bug) REFERENCES bug(id);
10832
22990
ALTER TABLE ONLY specificationbug
10833
22991
ADD CONSTRAINT specificationbug_specification_fk FOREIGN KEY (specification) REFERENCES specification(id);
10835
22994
ALTER TABLE ONLY specificationdependency
10836
22995
ADD CONSTRAINT specificationdependency_dependency_fk FOREIGN KEY (dependency) REFERENCES specification(id);
10838
22998
ALTER TABLE ONLY specificationdependency
10839
22999
ADD CONSTRAINT specificationdependency_specification_fk FOREIGN KEY (specification) REFERENCES specification(id);
10841
23002
ALTER TABLE ONLY specificationfeedback
10842
23003
ADD CONSTRAINT specificationfeedback_provider_fk FOREIGN KEY (reviewer) REFERENCES person(id);
10844
23006
ALTER TABLE ONLY specificationfeedback
10845
23007
ADD CONSTRAINT specificationfeedback_requester_fk FOREIGN KEY (requester) REFERENCES person(id);
10847
23010
ALTER TABLE ONLY specificationfeedback
10848
23011
ADD CONSTRAINT specificationfeedback_specification_fk FOREIGN KEY (specification) REFERENCES specification(id);
10850
23014
ALTER TABLE ONLY specificationmessage
10851
23015
ADD CONSTRAINT specificationmessage__message__fk FOREIGN KEY (message) REFERENCES message(id);
10853
23018
ALTER TABLE ONLY specificationmessage
10854
23019
ADD CONSTRAINT specificationmessage__specification__fk FOREIGN KEY (specification) REFERENCES specification(id);
10856
23022
ALTER TABLE ONLY specificationsubscription
10857
23023
ADD CONSTRAINT specificationsubscription_person_fk FOREIGN KEY (person) REFERENCES person(id);
10859
23026
ALTER TABLE ONLY specificationsubscription
10860
23027
ADD CONSTRAINT specificationsubscription_specification_fk FOREIGN KEY (specification) REFERENCES specification(id);
10862
23030
ALTER TABLE ONLY sprint
10863
23031
ADD CONSTRAINT sprint__icon__fk FOREIGN KEY (icon) REFERENCES libraryfilealias(id);
10865
23034
ALTER TABLE ONLY sprint
10866
23035
ADD CONSTRAINT sprint__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
10868
23038
ALTER TABLE ONLY sprint
10869
23039
ADD CONSTRAINT sprint__mugshot__fk FOREIGN KEY (mugshot) REFERENCES libraryfilealias(id);
10871
23042
ALTER TABLE ONLY sprint
10872
23043
ADD CONSTRAINT sprint_driver_fkey FOREIGN KEY (driver) REFERENCES person(id);
10874
23046
ALTER TABLE ONLY sprint
10875
23047
ADD CONSTRAINT sprint_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10877
23050
ALTER TABLE ONLY sprintattendance
10878
23051
ADD CONSTRAINT sprintattendance_attendee_fk FOREIGN KEY (attendee) REFERENCES person(id);
10880
23054
ALTER TABLE ONLY sprintattendance
10881
23055
ADD CONSTRAINT sprintattendance_sprint_fk FOREIGN KEY (sprint) REFERENCES sprint(id);
10883
23058
ALTER TABLE ONLY sprintspecification
10884
23059
ADD CONSTRAINT sprintspec_spec_fk FOREIGN KEY (specification) REFERENCES specification(id);
10886
23062
ALTER TABLE ONLY sprintspecification
10887
23063
ADD CONSTRAINT sprintspec_sprint_fk FOREIGN KEY (sprint) REFERENCES sprint(id);
10889
23066
ALTER TABLE ONLY sprintspecification
10890
23067
ADD CONSTRAINT sprintspecification__nominator__fk FOREIGN KEY (registrant) REFERENCES person(id);
10892
23070
ALTER TABLE ONLY sprintspecification
10893
23071
ADD CONSTRAINT sprintspecification_decider_fkey FOREIGN KEY (decider) REFERENCES person(id);
10895
ALTER TABLE ONLY staticdiff
10896
ADD CONSTRAINT staticdiff_diff_fkey FOREIGN KEY (diff) REFERENCES diff(id) ON DELETE CASCADE;
10898
23074
ALTER TABLE ONLY structuralsubscription
10899
23075
ADD CONSTRAINT structuralsubscription_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
10901
23078
ALTER TABLE ONLY structuralsubscription
10902
23079
ADD CONSTRAINT structuralsubscription_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10904
23082
ALTER TABLE ONLY structuralsubscription
10905
23083
ADD CONSTRAINT structuralsubscription_milestone_fkey FOREIGN KEY (milestone) REFERENCES milestone(id);
10907
23086
ALTER TABLE ONLY structuralsubscription
10908
23087
ADD CONSTRAINT structuralsubscription_product_fkey FOREIGN KEY (product) REFERENCES product(id);
10910
23090
ALTER TABLE ONLY structuralsubscription
10911
23091
ADD CONSTRAINT structuralsubscription_productseries_fkey FOREIGN KEY (productseries) REFERENCES productseries(id);
10913
23094
ALTER TABLE ONLY structuralsubscription
10914
23095
ADD CONSTRAINT structuralsubscription_project_fkey FOREIGN KEY (project) REFERENCES project(id);
10916
23098
ALTER TABLE ONLY structuralsubscription
10917
23099
ADD CONSTRAINT structuralsubscription_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10919
23102
ALTER TABLE ONLY structuralsubscription
10920
23103
ADD CONSTRAINT structuralsubscription_subscribed_by_fkey FOREIGN KEY (subscribed_by) REFERENCES person(id);
10922
23106
ALTER TABLE ONLY structuralsubscription
10923
23107
ADD CONSTRAINT structuralsubscription_subscriber_fkey FOREIGN KEY (subscriber) REFERENCES person(id);
23110
ALTER TABLE ONLY subunitstream
23111
ADD CONSTRAINT subunitstream_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
23114
ALTER TABLE ONLY subunitstream
23115
ADD CONSTRAINT subunitstream_stream_fkey FOREIGN KEY (stream) REFERENCES libraryfilealias(id);
23118
ALTER TABLE ONLY subunitstream
23119
ADD CONSTRAINT subunitstream_uploader_fkey FOREIGN KEY (uploader) REFERENCES person(id);
23122
ALTER TABLE ONLY suggestivepotemplate
23123
ADD CONSTRAINT suggestivepotemplate__potemplate__fk FOREIGN KEY (potemplate) REFERENCES potemplate(id) ON DELETE CASCADE;
10925
23126
ALTER TABLE ONLY teammembership
10926
23127
ADD CONSTRAINT teammembership_acknowledged_by_fkey FOREIGN KEY (acknowledged_by) REFERENCES person(id);
10928
23130
ALTER TABLE ONLY teammembership
10929
23131
ADD CONSTRAINT teammembership_person_fk FOREIGN KEY (person) REFERENCES person(id);
10931
23134
ALTER TABLE ONLY teammembership
10932
23135
ADD CONSTRAINT teammembership_proposed_by_fkey FOREIGN KEY (proposed_by) REFERENCES person(id);
10934
23138
ALTER TABLE ONLY teammembership
10935
23139
ADD CONSTRAINT teammembership_reviewed_by_fkey FOREIGN KEY (reviewed_by) REFERENCES person(id);
10937
23142
ALTER TABLE ONLY teammembership
10938
23143
ADD CONSTRAINT teammembership_team_fk FOREIGN KEY (team) REFERENCES person(id);
10940
23146
ALTER TABLE ONLY teamparticipation
10941
23147
ADD CONSTRAINT teamparticipation_person_fk FOREIGN KEY (person) REFERENCES person(id);
10943
23150
ALTER TABLE ONLY teamparticipation
10944
23151
ADD CONSTRAINT teamparticipation_team_fk FOREIGN KEY (team) REFERENCES person(id);
10946
23154
ALTER TABLE ONLY temporaryblobstorage
10947
23155
ADD CONSTRAINT temporaryblobstorage_file_alias_fkey FOREIGN KEY (file_alias) REFERENCES libraryfilealias(id);
10949
23158
ALTER TABLE ONLY translationgroup
10950
23159
ADD CONSTRAINT translationgroup_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10952
23162
ALTER TABLE ONLY translationimportqueueentry
10953
23163
ADD CONSTRAINT translationimportqueueentry__content__fk FOREIGN KEY (content) REFERENCES libraryfilealias(id);
10955
23166
ALTER TABLE ONLY translationimportqueueentry
10956
23167
ADD CONSTRAINT translationimportqueueentry__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10958
23170
ALTER TABLE ONLY translationimportqueueentry
10959
23171
ADD CONSTRAINT translationimportqueueentry__importer__fk FOREIGN KEY (importer) REFERENCES person(id);
10961
23174
ALTER TABLE ONLY translationimportqueueentry
10962
23175
ADD CONSTRAINT translationimportqueueentry__pofile__fk FOREIGN KEY (pofile) REFERENCES pofile(id);
10964
23178
ALTER TABLE ONLY translationimportqueueentry
10965
23179
ADD CONSTRAINT translationimportqueueentry__potemplate__fk FOREIGN KEY (potemplate) REFERENCES potemplate(id);
10967
23182
ALTER TABLE ONLY translationimportqueueentry
10968
23183
ADD CONSTRAINT translationimportqueueentry__productseries__fk FOREIGN KEY (productseries) REFERENCES productseries(id);
10970
23186
ALTER TABLE ONLY translationimportqueueentry
10971
23187
ADD CONSTRAINT translationimportqueueentry__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10973
23190
ALTER TABLE ONLY translationmessage
10974
23191
ADD CONSTRAINT translationmessage__msgstr0__fk FOREIGN KEY (msgstr0) REFERENCES potranslation(id);
10976
23194
ALTER TABLE ONLY translationmessage
10977
23195
ADD CONSTRAINT translationmessage__msgstr1__fk FOREIGN KEY (msgstr1) REFERENCES potranslation(id);
10979
23198
ALTER TABLE ONLY translationmessage
10980
23199
ADD CONSTRAINT translationmessage__msgstr2__fk FOREIGN KEY (msgstr2) REFERENCES potranslation(id);
10982
23202
ALTER TABLE ONLY translationmessage
10983
23203
ADD CONSTRAINT translationmessage__msgstr3__fk FOREIGN KEY (msgstr3) REFERENCES potranslation(id);
10985
23206
ALTER TABLE ONLY translationmessage
10986
23207
ADD CONSTRAINT translationmessage__msgstr4__fk FOREIGN KEY (msgstr4) REFERENCES potranslation(id);
10988
23210
ALTER TABLE ONLY translationmessage
10989
23211
ADD CONSTRAINT translationmessage__msgstr5__fk FOREIGN KEY (msgstr5) REFERENCES potranslation(id);
10991
ALTER TABLE ONLY translationmessage
10992
ADD CONSTRAINT translationmessage__pofile__fk FOREIGN KEY (pofile) REFERENCES pofile(id);
10994
23214
ALTER TABLE ONLY translationmessage
10995
23215
ADD CONSTRAINT translationmessage__potmsgset__fk FOREIGN KEY (potmsgset) REFERENCES potmsgset(id);
10997
23218
ALTER TABLE ONLY translationmessage
10998
23219
ADD CONSTRAINT translationmessage__reviewer__fk FOREIGN KEY (reviewer) REFERENCES person(id);
11000
23222
ALTER TABLE ONLY translationmessage
11001
23223
ADD CONSTRAINT translationmessage__submitter__fk FOREIGN KEY (submitter) REFERENCES person(id);
11003
23226
ALTER TABLE ONLY translationmessage
11004
23227
ADD CONSTRAINT translationmessage_language_fkey FOREIGN KEY (language) REFERENCES language(id);
11006
23230
ALTER TABLE ONLY translationmessage
11007
23231
ADD CONSTRAINT translationmessage_potemplate_fkey FOREIGN KEY (potemplate) REFERENCES potemplate(id);
11009
23234
ALTER TABLE ONLY translationrelicensingagreement
11010
23235
ADD CONSTRAINT translationrelicensingagreement__person__fk FOREIGN KEY (person) REFERENCES person(id);
11012
23238
ALTER TABLE ONLY translationtemplateitem
11013
23239
ADD CONSTRAINT translationtemplateitem_potemplate_fkey FOREIGN KEY (potemplate) REFERENCES potemplate(id);
11015
23242
ALTER TABLE ONLY translationtemplateitem
11016
23243
ADD CONSTRAINT translationtemplateitem_potmsgset_fkey FOREIGN KEY (potmsgset) REFERENCES potmsgset(id);
23246
ALTER TABLE ONLY translationtemplatesbuild
23247
ADD CONSTRAINT translationtemplatesbuild_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
23250
ALTER TABLE ONLY translationtemplatesbuild
23251
ADD CONSTRAINT translationtemplatesbuild_build_farm_job_fkey FOREIGN KEY (build_farm_job) REFERENCES buildfarmjob(id);
11018
23254
ALTER TABLE ONLY translator
11019
23255
ADD CONSTRAINT translator_language_fk FOREIGN KEY (language) REFERENCES language(id);
11021
23258
ALTER TABLE ONLY translator
11022
23259
ADD CONSTRAINT translator_person_fk FOREIGN KEY (translator) REFERENCES person(id);
11024
23262
ALTER TABLE ONLY translator
11025
23263
ADD CONSTRAINT translator_translationgroup_fk FOREIGN KEY (translationgroup) REFERENCES translationgroup(id);
11027
23266
ALTER TABLE ONLY usertouseremail
11028
23267
ADD CONSTRAINT usertouseremail__recipient__fk FOREIGN KEY (recipient) REFERENCES person(id);
11030
23270
ALTER TABLE ONLY usertouseremail
11031
23271
ADD CONSTRAINT usertouseremail__sender__fk FOREIGN KEY (sender) REFERENCES person(id);
11033
23274
ALTER TABLE ONLY vote
11034
23275
ADD CONSTRAINT vote_person_fk FOREIGN KEY (person) REFERENCES person(id);
11036
23278
ALTER TABLE ONLY vote
11037
23279
ADD CONSTRAINT vote_poll_fk FOREIGN KEY (poll) REFERENCES poll(id);
11039
23282
ALTER TABLE ONLY vote
11040
23283
ADD CONSTRAINT vote_poll_option_fk FOREIGN KEY (poll, option) REFERENCES polloption(poll, id);
11042
23286
ALTER TABLE ONLY votecast
11043
23287
ADD CONSTRAINT votecast_person_fk FOREIGN KEY (person) REFERENCES person(id);
11045
23290
ALTER TABLE ONLY votecast
11046
23291
ADD CONSTRAINT votecast_poll_fk FOREIGN KEY (poll) REFERENCES poll(id);
11048
ALTER TABLE ONLY webserviceban
11049
ADD CONSTRAINT webserviceban_consumer_fkey FOREIGN KEY (consumer) REFERENCES oauthconsumer(id);
11051
ALTER TABLE ONLY webserviceban
11052
ADD CONSTRAINT webserviceban_person_fkey FOREIGN KEY (person) REFERENCES person(id);
11054
ALTER TABLE ONLY webserviceban
11055
ADD CONSTRAINT webserviceban_token_fkey FOREIGN KEY (token) REFERENCES oauthaccesstoken(id);
11057
23294
ALTER TABLE ONLY wikiname
11058
23295
ADD CONSTRAINT wikiname_person_fk FOREIGN KEY (person) REFERENCES person(id);
11060
\i /usr/share/postgresql/8.4/contrib/debversion.sql