72
23
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).';
232
26
SET default_tablespace = '';
234
28
SET default_with_oids = false;
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';
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;
2629
43
CREATE FUNCTION pgstattuple(text) RETURNS pgstattuple_type
2631
AS '$libdir/pgstattuple', 'pgstattuple';
44
AS '$libdir/pgstattuple', 'pgstattuple'
2634
47
CREATE FUNCTION pgstattuple(oid) RETURNS pgstattuple_type
2636
AS '$libdir/pgstattuple', 'pgstattuplebyid';
48
AS '$libdir/pgstattuple', 'pgstattuplebyid'
2639
51
CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler
2641
AS '$libdir/plpgsql', 'plpgsql_call_handler';
52
AS '$libdir/plpgsql', 'plpgsql_call_handler'
2644
55
CREATE FUNCTION plpython_call_handler() RETURNS language_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;
56
AS '$libdir/plpython', 'plpython_call_handler'
4559
59
CREATE TABLE account (
4560
60
id integer NOT NULL,
15255
5304
wikiname text NOT NULL
15259
5307
CREATE SEQUENCE wikiname_id_seq
15261
5308
INCREMENT BY 1
15267
5313
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);
15279
5315
ALTER TABLE account ALTER COLUMN id SET DEFAULT nextval('account_id_seq'::regclass);
15282
5317
ALTER TABLE accountpassword ALTER COLUMN id SET DEFAULT nextval('accountpassword_id_seq'::regclass);
15285
5319
ALTER TABLE announcement ALTER COLUMN id SET DEFAULT nextval('announcement_id_seq'::regclass);
15288
5321
ALTER TABLE answercontact ALTER COLUMN id SET DEFAULT nextval('answercontact_id_seq'::regclass);
15291
5323
ALTER TABLE apportjob ALTER COLUMN id SET DEFAULT nextval('apportjob_id_seq'::regclass);
15294
5325
ALTER TABLE archive ALTER COLUMN id SET DEFAULT nextval('archive_id_seq'::regclass);
15297
5327
ALTER TABLE archivearch ALTER COLUMN id SET DEFAULT nextval('archivearch_id_seq'::regclass);
15300
5329
ALTER TABLE archiveauthtoken ALTER COLUMN id SET DEFAULT nextval('archiveauthtoken_id_seq'::regclass);
15303
5331
ALTER TABLE archivedependency ALTER COLUMN id SET DEFAULT nextval('archivedependency_id_seq'::regclass);
15306
5333
ALTER TABLE archivejob ALTER COLUMN id SET DEFAULT nextval('archivejob_id_seq'::regclass);
15309
5335
ALTER TABLE archivepermission ALTER COLUMN id SET DEFAULT nextval('archivepermission_id_seq'::regclass);
15312
5337
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);
15315
5341
ALTER TABLE binarypackagebuild ALTER COLUMN id SET DEFAULT nextval('binarypackagebuild_id_seq'::regclass);
15318
5343
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);
15324
5345
ALTER TABLE binarypackagepublishinghistory ALTER COLUMN id SET DEFAULT nextval('binarypackagepublishinghistory_id_seq'::regclass);
15327
5347
ALTER TABLE binarypackagerelease ALTER COLUMN id SET DEFAULT nextval('binarypackagerelease_id_seq'::regclass);
15330
5349
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);
15333
5357
ALTER TABLE branch ALTER COLUMN id SET DEFAULT nextval('branch_id_seq'::regclass);
15336
5359
ALTER TABLE branchjob ALTER COLUMN id SET DEFAULT nextval('branchjob_id_seq'::regclass);
15339
5361
ALTER TABLE branchmergeproposal ALTER COLUMN id SET DEFAULT nextval('branchmergeproposal_id_seq'::regclass);
15342
5363
ALTER TABLE branchmergeproposaljob ALTER COLUMN id SET DEFAULT nextval('branchmergeproposaljob_id_seq'::regclass);
15345
ALTER TABLE branchmergequeue ALTER COLUMN id SET DEFAULT nextval('branchmergequeue_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);
15348
5369
ALTER TABLE branchsubscription ALTER COLUMN id SET DEFAULT nextval('branchsubscription_id_seq'::regclass);
15351
5371
ALTER TABLE branchvisibilitypolicy ALTER COLUMN id SET DEFAULT nextval('branchvisibilitypolicy_id_seq'::regclass);
15354
5373
ALTER TABLE bug ALTER COLUMN id SET DEFAULT nextval('bug_id_seq'::regclass);
15357
5375
ALTER TABLE bugactivity ALTER COLUMN id SET DEFAULT nextval('bugactivity_id_seq'::regclass);
15360
5377
ALTER TABLE bugaffectsperson ALTER COLUMN id SET DEFAULT nextval('bugaffectsperson_id_seq'::regclass);
15363
5379
ALTER TABLE bugattachment ALTER COLUMN id SET DEFAULT nextval('bugattachment_id_seq'::regclass);
15366
5381
ALTER TABLE bugbranch ALTER COLUMN id SET DEFAULT nextval('bugbranch_id_seq'::regclass);
15369
5383
ALTER TABLE bugcve ALTER COLUMN id SET DEFAULT nextval('bugcve_id_seq'::regclass);
15372
5385
ALTER TABLE bugjob ALTER COLUMN id SET DEFAULT nextval('bugjob_id_seq'::regclass);
15375
5387
ALTER TABLE bugmessage ALTER COLUMN id SET DEFAULT nextval('bugmessage_id_seq'::regclass);
15378
5389
ALTER TABLE bugnomination ALTER COLUMN id SET DEFAULT nextval('bugnomination_id_seq'::regclass);
15381
5391
ALTER TABLE bugnotification ALTER COLUMN id SET DEFAULT nextval('bugnotification_id_seq'::regclass);
15384
5393
ALTER TABLE bugnotificationattachment ALTER COLUMN id SET DEFAULT nextval('bugnotificationattachment_id_seq'::regclass);
15387
5395
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);
15390
5401
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);
15411
5403
ALTER TABLE bugtag ALTER COLUMN id SET DEFAULT nextval('bugtag_id_seq'::regclass);
15414
5405
ALTER TABLE bugtask ALTER COLUMN id SET DEFAULT nextval('bugtask_id_seq'::regclass);
15417
5407
ALTER TABLE bugtracker ALTER COLUMN id SET DEFAULT nextval('bugtracker_id_seq'::regclass);
15420
5409
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);
15429
5411
ALTER TABLE bugtrackerperson ALTER COLUMN id SET DEFAULT nextval('bugtrackerperson_id_seq'::regclass);
15432
5413
ALTER TABLE bugwatch ALTER COLUMN id SET DEFAULT nextval('bugwatch_id_seq'::regclass);
15435
5415
ALTER TABLE bugwatchactivity ALTER COLUMN id SET DEFAULT nextval('bugwatchactivity_id_seq'::regclass);
15438
5417
ALTER TABLE builder ALTER COLUMN id SET DEFAULT nextval('builder_id_seq'::regclass);
15441
5419
ALTER TABLE buildfarmjob ALTER COLUMN id SET DEFAULT nextval('buildfarmjob_id_seq'::regclass);
15444
5421
ALTER TABLE buildpackagejob ALTER COLUMN id SET DEFAULT nextval('buildpackagejob_id_seq'::regclass);
15447
5423
ALTER TABLE buildqueue ALTER COLUMN id SET DEFAULT nextval('buildqueue_id_seq'::regclass);
15450
5425
ALTER TABLE codeimport ALTER COLUMN id SET DEFAULT nextval('codeimport_id_seq'::regclass);
15453
5427
ALTER TABLE codeimportevent ALTER COLUMN id SET DEFAULT nextval('codeimportevent_id_seq'::regclass);
15456
5429
ALTER TABLE codeimporteventdata ALTER COLUMN id SET DEFAULT nextval('codeimporteventdata_id_seq'::regclass);
15459
5431
ALTER TABLE codeimportjob ALTER COLUMN id SET DEFAULT nextval('codeimportjob_id_seq'::regclass);
15462
5433
ALTER TABLE codeimportmachine ALTER COLUMN id SET DEFAULT nextval('codeimportmachine_id_seq'::regclass);
15465
5435
ALTER TABLE codeimportresult ALTER COLUMN id SET DEFAULT nextval('codeimportresult_id_seq'::regclass);
15468
5437
ALTER TABLE codereviewmessage ALTER COLUMN id SET DEFAULT nextval('codereviewmessage_id_seq'::regclass);
15471
5439
ALTER TABLE codereviewvote ALTER COLUMN id SET DEFAULT nextval('codereviewvote_id_seq'::regclass);
15474
5441
ALTER TABLE commercialsubscription ALTER COLUMN id SET DEFAULT nextval('commercialsubscription_id_seq'::regclass);
15477
5443
ALTER TABLE component ALTER COLUMN id SET DEFAULT nextval('component_id_seq'::regclass);
15480
5445
ALTER TABLE componentselection ALTER COLUMN id SET DEFAULT nextval('componentselection_id_seq'::regclass);
15483
5447
ALTER TABLE continent ALTER COLUMN id SET DEFAULT nextval('continent_id_seq'::regclass);
15486
5449
ALTER TABLE country ALTER COLUMN id SET DEFAULT nextval('country_id_seq'::regclass);
15489
5451
ALTER TABLE customlanguagecode ALTER COLUMN id SET DEFAULT nextval('customlanguagecode_id_seq'::regclass);
15492
5453
ALTER TABLE cve ALTER COLUMN id SET DEFAULT nextval('cve_id_seq'::regclass);
15495
5455
ALTER TABLE cvereference ALTER COLUMN id SET DEFAULT nextval('cvereference_id_seq'::regclass);
15498
5457
ALTER TABLE diff ALTER COLUMN id SET DEFAULT nextval('diff_id_seq'::regclass);
15501
5459
ALTER TABLE distribution ALTER COLUMN id SET DEFAULT nextval('distribution_id_seq'::regclass);
15504
ALTER TABLE distributionjob ALTER COLUMN id SET DEFAULT nextval('distributionjob_id_seq'::regclass);
5461
ALTER TABLE distributionbounty ALTER COLUMN id SET DEFAULT nextval('distributionbounty_id_seq'::regclass);
15507
5463
ALTER TABLE distributionmirror ALTER COLUMN id SET DEFAULT nextval('distributionmirror_id_seq'::regclass);
15510
5465
ALTER TABLE distributionsourcepackage ALTER COLUMN id SET DEFAULT nextval('distributionsourcepackage_id_seq'::regclass);
15513
5467
ALTER TABLE distributionsourcepackagecache ALTER COLUMN id SET DEFAULT nextval('distributionsourcepackagecache_id_seq'::regclass);
15516
5469
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);
15519
5473
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);
15528
5475
ALTER TABLE distroserieslanguage ALTER COLUMN id SET DEFAULT nextval('distroserieslanguage_id_seq'::regclass);
15531
5477
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);
15537
5479
ALTER TABLE emailaddress ALTER COLUMN id SET DEFAULT nextval('emailaddress_id_seq'::regclass);
15540
5481
ALTER TABLE entitlement ALTER COLUMN id SET DEFAULT nextval('entitlement_id_seq'::regclass);
15543
5483
ALTER TABLE faq ALTER COLUMN id SET DEFAULT nextval('faq_id_seq'::regclass);
15546
5485
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);
15552
5487
ALTER TABLE flatpackagesetinclusion ALTER COLUMN id SET DEFAULT nextval('flatpackagesetinclusion_id_seq'::regclass);
15555
5489
ALTER TABLE fticache ALTER COLUMN id SET DEFAULT nextval('fticache_id_seq'::regclass);
15558
5491
ALTER TABLE gpgkey ALTER COLUMN id SET DEFAULT nextval('gpgkey_id_seq'::regclass);
15561
5493
ALTER TABLE hwdevice ALTER COLUMN id SET DEFAULT nextval('hwdevice_id_seq'::regclass);
15564
5495
ALTER TABLE hwdeviceclass ALTER COLUMN id SET DEFAULT nextval('hwdeviceclass_id_seq'::regclass);
15567
5497
ALTER TABLE hwdevicedriverlink ALTER COLUMN id SET DEFAULT nextval('hwdevicedriverlink_id_seq'::regclass);
15570
5499
ALTER TABLE hwdevicenamevariant ALTER COLUMN id SET DEFAULT nextval('hwdevicenamevariant_id_seq'::regclass);
15573
5501
ALTER TABLE hwdmihandle ALTER COLUMN id SET DEFAULT nextval('hwdmihandle_id_seq'::regclass);
15576
5503
ALTER TABLE hwdmivalue ALTER COLUMN id SET DEFAULT nextval('hwdmivalue_id_seq'::regclass);
15579
5505
ALTER TABLE hwdriver ALTER COLUMN id SET DEFAULT nextval('hwdriver_id_seq'::regclass);
15582
5507
ALTER TABLE hwsubmission ALTER COLUMN id SET DEFAULT nextval('hwsubmission_id_seq'::regclass);
15585
5509
ALTER TABLE hwsubmissionbug ALTER COLUMN id SET DEFAULT nextval('hwsubmissionbug_id_seq'::regclass);
15588
5511
ALTER TABLE hwsubmissiondevice ALTER COLUMN id SET DEFAULT nextval('hwsubmissiondevice_id_seq'::regclass);
15591
5513
ALTER TABLE hwsystemfingerprint ALTER COLUMN id SET DEFAULT nextval('hwsystemfingerprint_id_seq'::regclass);
15594
5515
ALTER TABLE hwtest ALTER COLUMN id SET DEFAULT nextval('hwtest_id_seq'::regclass);
15597
5517
ALTER TABLE hwtestanswer ALTER COLUMN id SET DEFAULT nextval('hwtestanswer_id_seq'::regclass);
15600
5519
ALTER TABLE hwtestanswerchoice ALTER COLUMN id SET DEFAULT nextval('hwtestanswerchoice_id_seq'::regclass);
15603
5521
ALTER TABLE hwtestanswercount ALTER COLUMN id SET DEFAULT nextval('hwtestanswercount_id_seq'::regclass);
15606
5523
ALTER TABLE hwtestanswercountdevice ALTER COLUMN id SET DEFAULT nextval('hwtestanswercountdevice_id_seq'::regclass);
15609
5525
ALTER TABLE hwtestanswerdevice ALTER COLUMN id SET DEFAULT nextval('hwtestanswerdevice_id_seq'::regclass);
15612
5527
ALTER TABLE hwvendorid ALTER COLUMN id SET DEFAULT nextval('hwvendorid_id_seq'::regclass);
15615
5529
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);
15621
5531
ALTER TABLE ircid ALTER COLUMN id SET DEFAULT nextval('ircid_id_seq'::regclass);
15624
5533
ALTER TABLE jabberid ALTER COLUMN id SET DEFAULT nextval('jabberid_id_seq'::regclass);
15627
5535
ALTER TABLE job ALTER COLUMN id SET DEFAULT nextval('job_id_seq'::regclass);
15630
5537
ALTER TABLE karma ALTER COLUMN id SET DEFAULT nextval('karma_id_seq'::regclass);
15633
5539
ALTER TABLE karmaaction ALTER COLUMN id SET DEFAULT nextval('karmaaction_id_seq'::regclass);
15636
5541
ALTER TABLE karmacache ALTER COLUMN id SET DEFAULT nextval('karmacache_id_seq'::regclass);
15639
5543
ALTER TABLE karmacategory ALTER COLUMN id SET DEFAULT nextval('karmacategory_id_seq'::regclass);
15642
5545
ALTER TABLE karmatotalcache ALTER COLUMN id SET DEFAULT nextval('karmatotalcache_id_seq'::regclass);
15645
5547
ALTER TABLE language ALTER COLUMN id SET DEFAULT nextval('language_id_seq'::regclass);
15648
5549
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);
15654
5551
ALTER TABLE launchpadstatistic ALTER COLUMN id SET DEFAULT nextval('launchpadstatistic_id_seq'::regclass);
15657
5553
ALTER TABLE libraryfilealias ALTER COLUMN id SET DEFAULT nextval('libraryfilealias_id_seq'::regclass);
15660
5555
ALTER TABLE libraryfilecontent ALTER COLUMN id SET DEFAULT nextval('libraryfilecontent_id_seq'::regclass);
15663
5557
ALTER TABLE libraryfiledownloadcount ALTER COLUMN id SET DEFAULT nextval('libraryfiledownloadcount_id_seq'::regclass);
15666
5559
ALTER TABLE logintoken ALTER COLUMN id SET DEFAULT nextval('logintoken_id_seq'::regclass);
15669
5561
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);
15672
5565
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);
15675
5569
ALTER TABLE mergedirectivejob ALTER COLUMN id SET DEFAULT nextval('mergedirectivejob_id_seq'::regclass);
15678
5571
ALTER TABLE message ALTER COLUMN id SET DEFAULT nextval('message_id_seq'::regclass);
15681
5573
ALTER TABLE messageapproval ALTER COLUMN id SET DEFAULT nextval('messageapproval_id_seq'::regclass);
15684
5575
ALTER TABLE messagechunk ALTER COLUMN id SET DEFAULT nextval('messagechunk_id_seq'::regclass);
15687
5577
ALTER TABLE milestone ALTER COLUMN id SET DEFAULT nextval('milestone_id_seq'::regclass);
15690
5579
ALTER TABLE mirror ALTER COLUMN id SET DEFAULT nextval('mirror_id_seq'::regclass);
15693
5581
ALTER TABLE mirrorcdimagedistroseries ALTER COLUMN id SET DEFAULT nextval('mirrorcdimagedistroseries_id_seq'::regclass);
15696
5583
ALTER TABLE mirrorcontent ALTER COLUMN id SET DEFAULT nextval('mirrorcontent_id_seq'::regclass);
15699
5585
ALTER TABLE mirrordistroarchseries ALTER COLUMN id SET DEFAULT nextval('mirrordistroarchseries_id_seq'::regclass);
15702
5587
ALTER TABLE mirrordistroseriessource ALTER COLUMN id SET DEFAULT nextval('mirrordistroseriessource_id_seq'::regclass);
15705
5589
ALTER TABLE mirrorproberecord ALTER COLUMN id SET DEFAULT nextval('mirrorproberecord_id_seq'::regclass);
15708
5591
ALTER TABLE mirrorsourcecontent ALTER COLUMN id SET DEFAULT nextval('mirrorsourcecontent_id_seq'::regclass);
15711
5593
ALTER TABLE nameblacklist ALTER COLUMN id SET DEFAULT nextval('nameblacklist_id_seq'::regclass);
15714
5595
ALTER TABLE oauthaccesstoken ALTER COLUMN id SET DEFAULT nextval('oauthaccesstoken_id_seq'::regclass);
15717
5597
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);
15720
5601
ALTER TABLE oauthrequesttoken ALTER COLUMN id SET DEFAULT nextval('oauthrequesttoken_id_seq'::regclass);
15723
5603
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);
15726
5611
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);
15732
5613
ALTER TABLE packagecopyrequest ALTER COLUMN id SET DEFAULT nextval('packagecopyrequest_id_seq'::regclass);
15735
5615
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);
15738
5619
ALTER TABLE packageset ALTER COLUMN id SET DEFAULT nextval('packageset_id_seq'::regclass);
15741
5621
ALTER TABLE packagesetgroup ALTER COLUMN id SET DEFAULT nextval('packagesetgroup_id_seq'::regclass);
15744
5623
ALTER TABLE packagesetinclusion ALTER COLUMN id SET DEFAULT nextval('packagesetinclusion_id_seq'::regclass);
15747
5625
ALTER TABLE packagesetsources ALTER COLUMN id SET DEFAULT nextval('packagesetsources_id_seq'::regclass);
15750
5627
ALTER TABLE packageupload ALTER COLUMN id SET DEFAULT nextval('packageupload_id_seq'::regclass);
15753
5629
ALTER TABLE packageuploadbuild ALTER COLUMN id SET DEFAULT nextval('packageuploadbuild_id_seq'::regclass);
15756
5631
ALTER TABLE packageuploadcustom ALTER COLUMN id SET DEFAULT nextval('packageuploadcustom_id_seq'::regclass);
15759
5633
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);
15765
5635
ALTER TABLE parsedapachelog ALTER COLUMN id SET DEFAULT nextval('parsedapachelog_id_seq'::regclass);
15768
5637
ALTER TABLE person ALTER COLUMN id SET DEFAULT nextval('person_id_seq'::regclass);
15771
5639
ALTER TABLE personlanguage ALTER COLUMN id SET DEFAULT nextval('personlanguage_id_seq'::regclass);
15774
5641
ALTER TABLE personlocation ALTER COLUMN id SET DEFAULT nextval('personlocation_id_seq'::regclass);
15777
5643
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);
15783
5645
ALTER TABLE pillarname ALTER COLUMN id SET DEFAULT nextval('pillarname_id_seq'::regclass);
15786
5647
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);
15789
5651
ALTER TABLE poexportrequest ALTER COLUMN id SET DEFAULT nextval('poexportrequest_id_seq'::regclass);
15792
5653
ALTER TABLE pofile ALTER COLUMN id SET DEFAULT nextval('pofile_id_seq'::regclass);
15795
5655
ALTER TABLE pofiletranslator ALTER COLUMN id SET DEFAULT nextval('pofiletranslator_id_seq'::regclass);
15798
5657
ALTER TABLE poll ALTER COLUMN id SET DEFAULT nextval('poll_id_seq'::regclass);
15801
5659
ALTER TABLE polloption ALTER COLUMN id SET DEFAULT nextval('polloption_id_seq'::regclass);
15804
5661
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);
15807
5665
ALTER TABLE potemplate ALTER COLUMN id SET DEFAULT nextval('potemplate_id_seq'::regclass);
15810
5667
ALTER TABLE potmsgset ALTER COLUMN id SET DEFAULT nextval('potmsgset_id_seq'::regclass);
15813
5669
ALTER TABLE potranslation ALTER COLUMN id SET DEFAULT nextval('potranslation_id_seq'::regclass);
15816
5671
ALTER TABLE previewdiff ALTER COLUMN id SET DEFAULT nextval('previewdiff_id_seq'::regclass);
15819
5673
ALTER TABLE processor ALTER COLUMN id SET DEFAULT nextval('processor_id_seq'::regclass);
15822
5675
ALTER TABLE processorfamily ALTER COLUMN id SET DEFAULT nextval('processorfamily_id_seq'::regclass);
15825
5677
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);
15828
5683
ALTER TABLE productlicense ALTER COLUMN id SET DEFAULT nextval('productlicense_id_seq'::regclass);
15831
5685
ALTER TABLE productrelease ALTER COLUMN id SET DEFAULT nextval('productrelease_id_seq'::regclass);
15834
5687
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);
15837
5693
ALTER TABLE project ALTER COLUMN id SET DEFAULT nextval('project_id_seq'::regclass);
15840
ALTER TABLE publisherconfig ALTER COLUMN id SET DEFAULT nextval('publisherconfig_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);
15843
5701
ALTER TABLE question ALTER COLUMN id SET DEFAULT nextval('question_id_seq'::regclass);
15846
5703
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);
15852
5705
ALTER TABLE questionmessage ALTER COLUMN id SET DEFAULT nextval('questionmessage_id_seq'::regclass);
15855
5707
ALTER TABLE questionreopening ALTER COLUMN id SET DEFAULT nextval('questionreopening_id_seq'::regclass);
15858
5709
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);
15861
5713
ALTER TABLE revision ALTER COLUMN id SET DEFAULT nextval('revision_id_seq'::regclass);
15864
5715
ALTER TABLE revisionauthor ALTER COLUMN id SET DEFAULT nextval('revisionauthor_id_seq'::regclass);
15867
5717
ALTER TABLE revisioncache ALTER COLUMN id SET DEFAULT nextval('revisioncache_id_seq'::regclass);
15870
5719
ALTER TABLE revisionparent ALTER COLUMN id SET DEFAULT nextval('revisionparent_id_seq'::regclass);
15873
5721
ALTER TABLE revisionproperty ALTER COLUMN id SET DEFAULT nextval('revisionproperty_id_seq'::regclass);
15876
5723
ALTER TABLE scriptactivity ALTER COLUMN id SET DEFAULT nextval('scriptactivity_id_seq'::regclass);
15879
5725
ALTER TABLE section ALTER COLUMN id SET DEFAULT nextval('section_id_seq'::regclass);
15882
5727
ALTER TABLE sectionselection ALTER COLUMN id SET DEFAULT nextval('sectionselection_id_seq'::regclass);
15885
5729
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);
15888
5747
ALTER TABLE signedcodeofconduct ALTER COLUMN id SET DEFAULT nextval('signedcodeofconduct_id_seq'::regclass);
15891
5749
ALTER TABLE sourcepackageformatselection ALTER COLUMN id SET DEFAULT nextval('sourcepackageformatselection_id_seq'::regclass);
15894
5751
ALTER TABLE sourcepackagename ALTER COLUMN id SET DEFAULT nextval('sourcepackagename_id_seq'::regclass);
15897
5753
ALTER TABLE sourcepackagepublishinghistory ALTER COLUMN id SET DEFAULT nextval('sourcepackagepublishinghistory_id_seq'::regclass);
15900
5755
ALTER TABLE sourcepackagerecipe ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipe_id_seq'::regclass);
15903
5757
ALTER TABLE sourcepackagerecipebuild ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipebuild_id_seq'::regclass);
15906
5759
ALTER TABLE sourcepackagerecipebuildjob ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipebuildjob_id_seq'::regclass);
15909
5761
ALTER TABLE sourcepackagerecipedata ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipedata_id_seq'::regclass);
15912
5763
ALTER TABLE sourcepackagerecipedatainstruction ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipedatainstruction_id_seq'::regclass);
15915
5765
ALTER TABLE sourcepackagerecipedistroseries ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipedistroseries_id_seq'::regclass);
15918
5767
ALTER TABLE sourcepackagerelease ALTER COLUMN id SET DEFAULT nextval('sourcepackagerelease_id_seq'::regclass);
15921
5769
ALTER TABLE specification ALTER COLUMN id SET DEFAULT nextval('specification_id_seq'::regclass);
15924
5771
ALTER TABLE specificationbranch ALTER COLUMN id SET DEFAULT nextval('specificationbranch_id_seq'::regclass);
15927
5773
ALTER TABLE specificationbug ALTER COLUMN id SET DEFAULT nextval('specificationbug_id_seq'::regclass);
15930
5775
ALTER TABLE specificationdependency ALTER COLUMN id SET DEFAULT nextval('specificationdependency_id_seq'::regclass);
15933
5777
ALTER TABLE specificationfeedback ALTER COLUMN id SET DEFAULT nextval('specificationfeedback_id_seq'::regclass);
15936
5779
ALTER TABLE specificationmessage ALTER COLUMN id SET DEFAULT nextval('specificationmessage_id_seq'::regclass);
15939
5781
ALTER TABLE specificationsubscription ALTER COLUMN id SET DEFAULT nextval('specificationsubscription_id_seq'::regclass);
15942
5783
ALTER TABLE sprint ALTER COLUMN id SET DEFAULT nextval('sprint_id_seq'::regclass);
15945
5785
ALTER TABLE sprintattendance ALTER COLUMN id SET DEFAULT nextval('sprintattendance_id_seq'::regclass);
15948
5787
ALTER TABLE sprintspecification ALTER COLUMN id SET DEFAULT nextval('sprintspecification_id_seq'::regclass);
15951
5789
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);
15954
5795
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);
15960
5797
ALTER TABLE teammembership ALTER COLUMN id SET DEFAULT nextval('teammembership_id_seq'::regclass);
15963
5799
ALTER TABLE teamparticipation ALTER COLUMN id SET DEFAULT nextval('teamparticipation_id_seq'::regclass);
15966
5801
ALTER TABLE temporaryblobstorage ALTER COLUMN id SET DEFAULT nextval('temporaryblobstorage_id_seq'::regclass);
15969
5803
ALTER TABLE translationgroup ALTER COLUMN id SET DEFAULT nextval('translationgroup_id_seq'::regclass);
15972
5805
ALTER TABLE translationimportqueueentry ALTER COLUMN id SET DEFAULT nextval('translationimportqueueentry_id_seq'::regclass);
15975
5807
ALTER TABLE translationmessage ALTER COLUMN id SET DEFAULT nextval('translationmessage_id_seq'::regclass);
15978
5809
ALTER TABLE translationrelicensingagreement ALTER COLUMN id SET DEFAULT nextval('translationrelicensingagreement_id_seq'::regclass);
15981
5811
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);
15987
5813
ALTER TABLE translator ALTER COLUMN id SET DEFAULT nextval('translator_id_seq'::regclass);
15990
5815
ALTER TABLE usertouseremail ALTER COLUMN id SET DEFAULT nextval('usertouseremail_id_seq'::regclass);
15993
5817
ALTER TABLE vote ALTER COLUMN id SET DEFAULT nextval('vote_id_seq'::regclass);
15996
5819
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);
15999
5823
ALTER TABLE wikiname ALTER COLUMN id SET DEFAULT nextval('wikiname_id_seq'::regclass);
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);
5825
ALTER TABLE ONLY account
5826
ADD CONSTRAINT account_openid_identifier_key UNIQUE (openid_identifier);
16014
5828
ALTER TABLE ONLY account
16015
5829
ADD CONSTRAINT account_pkey PRIMARY KEY (id);
16018
5831
ALTER TABLE ONLY accountpassword
16019
5832
ADD CONSTRAINT accountpassword_account_key UNIQUE (account);
16022
5834
ALTER TABLE ONLY accountpassword
16023
5835
ADD CONSTRAINT accountpassword_pkey PRIMARY KEY (id);
16026
5837
ALTER TABLE ONLY announcement
16027
5838
ADD CONSTRAINT announcement_pkey PRIMARY KEY (id);
16030
5840
ALTER TABLE ONLY apportjob
16031
5841
ADD CONSTRAINT apportjob__job__key UNIQUE (job);
16034
5843
ALTER TABLE ONLY apportjob
16035
5844
ADD CONSTRAINT apportjob_pkey PRIMARY KEY (id);
16037
5846
ALTER TABLE apportjob CLUSTER ON apportjob_pkey;
16040
5848
ALTER TABLE ONLY archive
16041
5849
ADD CONSTRAINT archive_pkey PRIMARY KEY (id);
16044
5851
ALTER TABLE ONLY archivearch
16045
5852
ADD CONSTRAINT archivearch__processorfamily__archive__key UNIQUE (processorfamily, archive);
16048
5854
ALTER TABLE ONLY archivearch
16049
5855
ADD CONSTRAINT archivearch_pkey PRIMARY KEY (id);
16052
5857
ALTER TABLE ONLY archiveauthtoken
16053
5858
ADD CONSTRAINT archiveauthtoken_pkey PRIMARY KEY (id);
16056
5860
ALTER TABLE ONLY archiveauthtoken
16057
5861
ADD CONSTRAINT archiveauthtoken_token_key UNIQUE (token);
16060
5863
ALTER TABLE ONLY archivedependency
16061
5864
ADD CONSTRAINT archivedependency__unique UNIQUE (archive, dependency);
16064
5866
ALTER TABLE ONLY archivedependency
16065
5867
ADD CONSTRAINT archivedependency_pkey PRIMARY KEY (id);
16068
5869
ALTER TABLE ONLY archivejob
16069
5870
ADD CONSTRAINT archivejob__job__key UNIQUE (job);
16072
5872
ALTER TABLE ONLY archivejob
16073
5873
ADD CONSTRAINT archivejob_pkey PRIMARY KEY (id);
16076
5875
ALTER TABLE ONLY archivepermission
16077
5876
ADD CONSTRAINT archivepermission_pkey PRIMARY KEY (id);
16080
5878
ALTER TABLE ONLY archivesubscriber
16081
5879
ADD CONSTRAINT archivesubscriber_pkey PRIMARY KEY (id);
16084
5881
ALTER TABLE ONLY revisionauthor
16085
5882
ADD CONSTRAINT archuserid_archuserid_key UNIQUE (name);
16088
5884
ALTER TABLE ONLY revisionauthor
16089
5885
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);
16092
5893
ALTER TABLE ONLY binarypackagerelease
16093
5894
ADD CONSTRAINT binarypackage_pkey PRIMARY KEY (id);
16096
5896
ALTER TABLE ONLY binarypackagebuild
16097
5897
ADD CONSTRAINT binarypackagebuild_pkey PRIMARY KEY (id);
16100
5899
ALTER TABLE ONLY binarypackagefile
16101
5900
ADD CONSTRAINT binarypackagefile_pkey PRIMARY KEY (id);
16104
5902
ALTER TABLE ONLY binarypackagename
16105
5903
ADD CONSTRAINT binarypackagename_name_key UNIQUE (name);
16108
5905
ALTER TABLE ONLY binarypackagename
16109
5906
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);
16120
5908
ALTER TABLE ONLY binarypackagerelease
16121
5909
ADD CONSTRAINT binarypackagerelease_binarypackagename_key UNIQUE (binarypackagename, build, version);
5911
ALTER TABLE binarypackagerelease CLUSTER ON binarypackagerelease_binarypackagename_key;
16124
5913
ALTER TABLE ONLY binarypackagerelease
16125
5914
ADD CONSTRAINT binarypackagerelease_build_name_uniq UNIQUE (build, binarypackagename);
16128
ALTER TABLE ONLY binarypackagereleasecontents
16129
ADD CONSTRAINT binarypackagereleasecontents_pkey PRIMARY KEY (binarypackagerelease, binarypackagepath);
16132
5916
ALTER TABLE ONLY binarypackagereleasedownloadcount
16133
5917
ADD CONSTRAINT binarypackagereleasedownloadcount__archive__binary_package_rele UNIQUE (archive, binary_package_release, day, country);
16136
5919
ALTER TABLE ONLY binarypackagereleasedownloadcount
16137
5920
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);
16140
5940
ALTER TABLE ONLY branch
16141
5941
ADD CONSTRAINT branch__unique_name__key UNIQUE (unique_name);
16144
5943
ALTER TABLE ONLY branch
16145
5944
ADD CONSTRAINT branch_pkey PRIMARY KEY (id);
16148
5946
ALTER TABLE ONLY branch
16149
5947
ADD CONSTRAINT branch_url_unique UNIQUE (url);
16152
5949
ALTER TABLE ONLY branchjob
16153
5950
ADD CONSTRAINT branchjob_job_key UNIQUE (job);
16156
5952
ALTER TABLE ONLY branchjob
16157
5953
ADD CONSTRAINT branchjob_pkey PRIMARY KEY (id);
16159
5955
ALTER TABLE branchjob CLUSTER ON branchjob_pkey;
16162
5957
ALTER TABLE ONLY branchmergeproposal
16163
5958
ADD CONSTRAINT branchmergeproposal_pkey PRIMARY KEY (id);
16166
5960
ALTER TABLE ONLY branchmergeproposaljob
16167
5961
ADD CONSTRAINT branchmergeproposaljob_job_key UNIQUE (job);
16170
5963
ALTER TABLE ONLY branchmergeproposaljob
16171
5964
ADD CONSTRAINT branchmergeproposaljob_pkey PRIMARY KEY (id);
16174
ALTER TABLE ONLY branchmergequeue
16175
ADD CONSTRAINT branchmergequeue_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);
16178
5972
ALTER TABLE ONLY branchsubscription
16179
5973
ADD CONSTRAINT branchsubscription__person__branch__key UNIQUE (person, branch);
16182
5975
ALTER TABLE ONLY branchsubscription
16183
5976
ADD CONSTRAINT branchsubscription_pkey PRIMARY KEY (id);
16186
5978
ALTER TABLE ONLY branchvisibilitypolicy
16187
5979
ADD CONSTRAINT branchvisibilitypolicy_pkey PRIMARY KEY (id);
16190
5981
ALTER TABLE ONLY bugbranch
16191
5982
ADD CONSTRAINT bug_branch_unique UNIQUE (bug, branch);
5984
ALTER TABLE ONLY bug
5985
ADD CONSTRAINT bug_name_key UNIQUE (name);
16194
5987
ALTER TABLE ONLY bug
16195
5988
ADD CONSTRAINT bug_pkey PRIMARY KEY (id);
16198
5990
ALTER TABLE ONLY bugactivity
16199
5991
ADD CONSTRAINT bugactivity_pkey PRIMARY KEY (id);
16202
5993
ALTER TABLE ONLY bugaffectsperson
16203
5994
ADD CONSTRAINT bugaffectsperson_bug_person_uniq UNIQUE (bug, person);
16206
5996
ALTER TABLE ONLY bugaffectsperson
16207
5997
ADD CONSTRAINT bugaffectsperson_pkey PRIMARY KEY (id);
16210
5999
ALTER TABLE ONLY bugattachment
16211
6000
ADD CONSTRAINT bugattachment_pkey PRIMARY KEY (id);
16214
6002
ALTER TABLE ONLY bugbranch
16215
6003
ADD CONSTRAINT bugbranch_pkey PRIMARY KEY (id);
16218
6005
ALTER TABLE ONLY bugcve
16219
6006
ADD CONSTRAINT bugcve_bug_cve_uniq UNIQUE (bug, cve);
16222
6008
ALTER TABLE ONLY bugcve
16223
6009
ADD CONSTRAINT bugcve_pkey PRIMARY KEY (id);
16226
6011
ALTER TABLE ONLY bugjob
16227
6012
ADD CONSTRAINT bugjob__job__key UNIQUE (job);
16230
6014
ALTER TABLE ONLY bugjob
16231
6015
ADD CONSTRAINT bugjob_pkey PRIMARY KEY (id);
16233
6017
ALTER TABLE bugjob CLUSTER ON bugjob_pkey;
16236
ALTER TABLE ONLY bugmessage
16237
ADD CONSTRAINT bugmessage__bug__index__key UNIQUE (bug, index);
16240
6019
ALTER TABLE ONLY bugmessage
16241
6020
ADD CONSTRAINT bugmessage__bug__message__key UNIQUE (bug, message);
16244
6022
ALTER TABLE ONLY bugmessage
16245
6023
ADD CONSTRAINT bugmessage__bugwatch__remote_comment_id__key UNIQUE (bugwatch, remote_comment_id);
16248
6025
ALTER TABLE ONLY bugmessage
16249
6026
ADD CONSTRAINT bugmessage_pkey PRIMARY KEY (id);
16252
ALTER TABLE ONLY bugmute
16253
ADD CONSTRAINT bugmute_pkey PRIMARY KEY (person, bug);
16256
6028
ALTER TABLE ONLY bugnomination
16257
6029
ADD CONSTRAINT bugnomination_pkey PRIMARY KEY (id);
16260
6031
ALTER TABLE ONLY bugnotification
16261
6032
ADD CONSTRAINT bugnotification__bug__message__unq UNIQUE (bug, message);
16264
6034
ALTER TABLE ONLY bugnotification
16265
6035
ADD CONSTRAINT bugnotification_pkey PRIMARY KEY (id);
6037
ALTER TABLE bugnotification CLUSTER ON bugnotification_pkey;
16268
6039
ALTER TABLE ONLY bugnotificationarchive
16269
6040
ADD CONSTRAINT bugnotificationarchive__bug__message__key UNIQUE (bug, message);
16272
6042
ALTER TABLE ONLY bugnotificationarchive
16273
6043
ADD CONSTRAINT bugnotificationarchive_pk PRIMARY KEY (id);
16276
6045
ALTER TABLE ONLY bugnotificationattachment
16277
6046
ADD CONSTRAINT bugnotificationattachment_pkey PRIMARY KEY (id);
16280
ALTER TABLE ONLY bugnotificationfilter
16281
ADD CONSTRAINT bugnotificationfilter_pkey PRIMARY KEY (bug_notification, bug_subscription_filter);
16284
6048
ALTER TABLE ONLY bugnotificationrecipient
16285
6049
ADD CONSTRAINT bugnotificationrecipient__bug_notificaion__person__key UNIQUE (bug_notification, person);
16288
6051
ALTER TABLE ONLY bugnotificationrecipient
16289
6052
ADD CONSTRAINT bugnotificationrecipient_pkey PRIMARY KEY (id);
16292
6054
ALTER TABLE ONLY bugnotificationrecipientarchive
16293
6055
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);
16296
6069
ALTER TABLE ONLY bugsubscription
16297
6070
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);
16328
6072
ALTER TABLE ONLY bugtracker
16329
6073
ADD CONSTRAINT bugsystem_pkey PRIMARY KEY (id);
16332
6075
ALTER TABLE ONLY bugtag
16333
6076
ADD CONSTRAINT bugtag__tag__bug__key UNIQUE (tag, bug);
16336
6078
ALTER TABLE ONLY bugtag
16337
6079
ADD CONSTRAINT bugtag_pkey PRIMARY KEY (id);
16340
6081
ALTER TABLE ONLY bugtask
16341
6082
ADD CONSTRAINT bugtask_pkey PRIMARY KEY (id);
16344
6084
ALTER TABLE ONLY bugtrackeralias
16345
6085
ADD CONSTRAINT bugtracker__base_url__key UNIQUE (base_url);
16348
6087
ALTER TABLE ONLY bugtrackeralias
16349
6088
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);
16372
6090
ALTER TABLE ONLY bugtrackerperson
16373
6091
ADD CONSTRAINT bugtrackerperson__bugtracker__name__key UNIQUE (bugtracker, name);
16376
6093
ALTER TABLE ONLY bugtrackerperson
16377
6094
ADD CONSTRAINT bugtrackerperson_pkey PRIMARY KEY (id);
16380
6096
ALTER TABLE ONLY bugwatch
16381
6097
ADD CONSTRAINT bugwatch_bugtask_target UNIQUE (id, bug);
16384
6099
ALTER TABLE ONLY bugwatch
16385
6100
ADD CONSTRAINT bugwatch_pkey PRIMARY KEY (id);
16388
6102
ALTER TABLE ONLY bugwatchactivity
16389
6103
ADD CONSTRAINT bugwatchactivity_pkey PRIMARY KEY (id);
16392
6105
ALTER TABLE ONLY builder
16393
6106
ADD CONSTRAINT builder_pkey PRIMARY KEY (id);
16396
6108
ALTER TABLE ONLY builder
16397
6109
ADD CONSTRAINT builder_url_key UNIQUE (url);
16400
6111
ALTER TABLE ONLY buildfarmjob
16401
6112
ADD CONSTRAINT buildfarmjob_pkey PRIMARY KEY (id);
16404
6114
ALTER TABLE ONLY buildpackagejob
16405
6115
ADD CONSTRAINT buildpackagejob__build__key UNIQUE (build);
16408
6117
ALTER TABLE ONLY buildpackagejob
16409
6118
ADD CONSTRAINT buildpackagejob__job__key UNIQUE (job);
16412
6120
ALTER TABLE ONLY buildpackagejob
16413
6121
ADD CONSTRAINT buildpackagejob_pkey PRIMARY KEY (id);
16416
6123
ALTER TABLE ONLY buildqueue
16417
6124
ADD CONSTRAINT buildqueue__job__key UNIQUE (job);
16420
6126
ALTER TABLE ONLY buildqueue
16421
6127
ADD CONSTRAINT buildqueue_pkey PRIMARY KEY (id);
16424
6129
ALTER TABLE ONLY revision
16425
6130
ADD CONSTRAINT changeset_pkey PRIMARY KEY (id);
16428
6132
ALTER TABLE ONLY codeimport
16429
6133
ADD CONSTRAINT codeimport_branch_key UNIQUE (branch);
16432
6135
ALTER TABLE ONLY codeimport
16433
6136
ADD CONSTRAINT codeimport_pkey PRIMARY KEY (id);
16436
6138
ALTER TABLE ONLY codeimportevent
16437
6139
ADD CONSTRAINT codeimportevent_pkey PRIMARY KEY (id);
16440
6141
ALTER TABLE ONLY codeimporteventdata
16441
6142
ADD CONSTRAINT codeimporteventdata__event__data_type__key UNIQUE (event, data_type);
16444
6144
ALTER TABLE ONLY codeimporteventdata
16445
6145
ADD CONSTRAINT codeimporteventdata_pkey PRIMARY KEY (id);
16448
6147
ALTER TABLE ONLY codeimportjob
16449
6148
ADD CONSTRAINT codeimportjob__code_import__key UNIQUE (code_import);
16452
6150
ALTER TABLE ONLY codeimportjob
16453
6151
ADD CONSTRAINT codeimportjob_pkey PRIMARY KEY (id);
16456
6153
ALTER TABLE ONLY codeimportmachine
16457
6154
ADD CONSTRAINT codeimportmachine_hostname_key UNIQUE (hostname);
16460
6156
ALTER TABLE ONLY codeimportmachine
16461
6157
ADD CONSTRAINT codeimportmachine_pkey PRIMARY KEY (id);
16464
6159
ALTER TABLE ONLY codeimportresult
16465
6160
ADD CONSTRAINT codeimportresult_pkey PRIMARY KEY (id);
16468
6162
ALTER TABLE ONLY codereviewmessage
16469
6163
ADD CONSTRAINT codereviewmessage__branch_merge_proposal__id_key UNIQUE (branch_merge_proposal, id);
16472
6165
ALTER TABLE ONLY codereviewmessage
16473
6166
ADD CONSTRAINT codereviewmessage_message_key UNIQUE (message);
16476
6168
ALTER TABLE ONLY codereviewmessage
16477
6169
ADD CONSTRAINT codereviewmessage_pkey PRIMARY KEY (id);
16480
6171
ALTER TABLE ONLY codereviewvote
16481
6172
ADD CONSTRAINT codereviewvote_pkey PRIMARY KEY (id);
16484
6174
ALTER TABLE ONLY commercialsubscription
16485
6175
ADD CONSTRAINT commercialsubscription_pkey PRIMARY KEY (id);
16488
6177
ALTER TABLE ONLY component
16489
6178
ADD CONSTRAINT component_name_key UNIQUE (name);
16492
6180
ALTER TABLE ONLY component
16493
6181
ADD CONSTRAINT component_pkey PRIMARY KEY (id);
16496
6183
ALTER TABLE ONLY componentselection
16497
6184
ADD CONSTRAINT componentselection__distroseries__component__key UNIQUE (distroseries, component);
16500
6186
ALTER TABLE ONLY componentselection
16501
6187
ADD CONSTRAINT componentselection_pkey PRIMARY KEY (id);
16504
6189
ALTER TABLE ONLY continent
16505
6190
ADD CONSTRAINT continent_code_key UNIQUE (code);
16508
6192
ALTER TABLE ONLY continent
16509
6193
ADD CONSTRAINT continent_name_key UNIQUE (name);
16512
6195
ALTER TABLE ONLY continent
16513
6196
ADD CONSTRAINT continent_pkey PRIMARY KEY (id);
16516
6198
ALTER TABLE ONLY country
16517
6199
ADD CONSTRAINT country_code2_uniq UNIQUE (iso3166code2);
16520
6201
ALTER TABLE ONLY country
16521
6202
ADD CONSTRAINT country_code3_uniq UNIQUE (iso3166code3);
16524
6204
ALTER TABLE ONLY country
16525
6205
ADD CONSTRAINT country_name_uniq UNIQUE (name);
16528
6207
ALTER TABLE ONLY country
16529
6208
ADD CONSTRAINT country_pkey PRIMARY KEY (id);
16532
6210
ALTER TABLE ONLY customlanguagecode
16533
6211
ADD CONSTRAINT customlanguagecode_pkey PRIMARY KEY (id);
16536
6213
ALTER TABLE ONLY cve
16537
6214
ADD CONSTRAINT cve_pkey PRIMARY KEY (id);
16540
6216
ALTER TABLE ONLY cve
16541
6217
ADD CONSTRAINT cve_sequence_uniq UNIQUE (sequence);
16544
6219
ALTER TABLE ONLY cvereference
16545
6220
ADD CONSTRAINT cvereference_pkey PRIMARY KEY (id);
16548
6222
ALTER TABLE ONLY databasecpustats
16549
6223
ADD CONSTRAINT databasecpustats_pkey PRIMARY KEY (date_created, username);
16552
ALTER TABLE ONLY databasediskutilization
16553
ADD CONSTRAINT databasediskutilization_pkey PRIMARY KEY (date_created, sort);
16556
6225
ALTER TABLE ONLY databasereplicationlag
16557
6226
ADD CONSTRAINT databasereplicationlag_pkey PRIMARY KEY (node);
16560
6228
ALTER TABLE ONLY databasetablestats
16561
6229
ADD CONSTRAINT databasetablestats_pkey PRIMARY KEY (date_created, schemaname, relname);
16563
6231
ALTER TABLE databasetablestats CLUSTER ON databasetablestats_pkey;
16566
6233
ALTER TABLE ONLY diff
16567
6234
ADD CONSTRAINT diff_pkey PRIMARY KEY (id);
16570
6236
ALTER TABLE ONLY distribution
16571
6237
ADD CONSTRAINT distribution_name_key UNIQUE (name);
16574
6239
ALTER TABLE ONLY distribution
16575
6240
ADD CONSTRAINT distribution_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);
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);
16586
6248
ALTER TABLE ONLY distributionmirror
16587
6249
ADD CONSTRAINT distributionmirror_ftp_base_url_key UNIQUE (ftp_base_url);
16590
6251
ALTER TABLE ONLY distributionmirror
16591
6252
ADD CONSTRAINT distributionmirror_http_base_url_key UNIQUE (http_base_url);
16594
6254
ALTER TABLE ONLY distributionmirror
16595
6255
ADD CONSTRAINT distributionmirror_name_key UNIQUE (name);
16598
6257
ALTER TABLE ONLY distributionmirror
16599
6258
ADD CONSTRAINT distributionmirror_pkey PRIMARY KEY (id);
16602
6260
ALTER TABLE ONLY distributionmirror
16603
6261
ADD CONSTRAINT distributionmirror_rsync_base_url_key UNIQUE (rsync_base_url);
16606
6263
ALTER TABLE ONLY distributionsourcepackage
16607
6264
ADD CONSTRAINT distributionpackage__sourcepackagename__distribution__key UNIQUE (sourcepackagename, distribution);
16609
6266
ALTER TABLE distributionsourcepackage CLUSTER ON distributionpackage__sourcepackagename__distribution__key;
16612
6268
ALTER TABLE ONLY distributionsourcepackage
16613
6269
ADD CONSTRAINT distributionsourcepackage_pkey PRIMARY KEY (id);
16616
6271
ALTER TABLE ONLY distributionsourcepackagecache
16617
6272
ADD CONSTRAINT distributionsourcepackagecache__distribution__sourcepackagename UNIQUE (distribution, sourcepackagename, archive);
16620
6274
ALTER TABLE ONLY distributionsourcepackagecache
16621
6275
ADD CONSTRAINT distributionsourcepackagecache_pkey PRIMARY KEY (id);
16624
6277
ALTER TABLE ONLY distroarchseries
16625
6278
ADD CONSTRAINT distroarchrelease_pkey PRIMARY KEY (id);
16628
6280
ALTER TABLE ONLY distroarchseries
16629
6281
ADD CONSTRAINT distroarchseries__architecturetag__distroseries__key UNIQUE (architecturetag, distroseries);
16632
6283
ALTER TABLE ONLY distroarchseries
16633
6284
ADD CONSTRAINT distroarchseries__processorfamily__distroseries__key UNIQUE (processorfamily, distroseries);
16636
ALTER TABLE ONLY distroseries
16637
ADD CONSTRAINT distrorelease__distribution__name__key UNIQUE (distribution, name);
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);
16640
6298
ALTER TABLE ONLY distroseries
16641
6299
ADD CONSTRAINT distrorelease_pkey PRIMARY KEY (id);
16644
6301
ALTER TABLE ONLY distroserieslanguage
16645
6302
ADD CONSTRAINT distroreleaselanguage_distrorelease_language_uniq UNIQUE (distroseries, language);
16648
6304
ALTER TABLE ONLY distroserieslanguage
16649
6305
ADD CONSTRAINT distroreleaselanguage_pkey PRIMARY KEY (id);
16652
6307
ALTER TABLE ONLY distroseriespackagecache
16653
6308
ADD CONSTRAINT distroreleasepackagecache_pkey PRIMARY KEY (id);
16656
6310
ALTER TABLE ONLY packageupload
16657
6311
ADD CONSTRAINT distroreleasequeue_pkey PRIMARY KEY (id);
16660
6313
ALTER TABLE ONLY packageuploadbuild
16661
6314
ADD CONSTRAINT distroreleasequeuebuild__distroreleasequeue__build__unique UNIQUE (packageupload, build);
16664
6316
ALTER TABLE ONLY packageuploadbuild
16665
6317
ADD CONSTRAINT distroreleasequeuebuild_pkey PRIMARY KEY (id);
16668
6319
ALTER TABLE ONLY packageuploadcustom
16669
6320
ADD CONSTRAINT distroreleasequeuecustom_pkey PRIMARY KEY (id);
16672
6322
ALTER TABLE ONLY packageuploadsource
16673
6323
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);
16696
6325
ALTER TABLE ONLY distroseriespackagecache
16697
6326
ADD CONSTRAINT distroseriespackagecache__distroseries__binarypackagename__arch UNIQUE (distroseries, binarypackagename, archive);
16700
ALTER TABLE ONLY distroseriesparent
16701
ADD CONSTRAINT distroseriesparent_pkey PRIMARY KEY (id);
16704
6328
ALTER TABLE ONLY emailaddress
16705
6329
ADD CONSTRAINT emailaddress_pkey PRIMARY KEY (id);
16708
6331
ALTER TABLE ONLY entitlement
16709
6332
ADD CONSTRAINT entitlement_pkey PRIMARY KEY (id);
16712
6334
ALTER TABLE ONLY faq
16713
6335
ADD CONSTRAINT faq_pkey PRIMARY KEY (id);
16716
6337
ALTER TABLE ONLY featureflag
16717
6338
ADD CONSTRAINT feature_flag_pkey PRIMARY KEY (scope, flag);
16720
6340
ALTER TABLE ONLY featureflag
16721
6341
ADD CONSTRAINT feature_flag_unique_priority_per_flag UNIQUE (flag, priority);
16724
6343
ALTER TABLE ONLY featuredproject
16725
6344
ADD CONSTRAINT featuredproject_pkey PRIMARY KEY (id);
16728
ALTER TABLE ONLY featureflagchangelogentry
16729
ADD CONSTRAINT featureflagchangelogentry_pkey PRIMARY KEY (id);
16732
6346
ALTER TABLE ONLY flatpackagesetinclusion
16733
6347
ADD CONSTRAINT flatpackagesetinclusion__parent__child__key UNIQUE (parent, child);
16736
6349
ALTER TABLE ONLY flatpackagesetinclusion
16737
6350
ADD CONSTRAINT flatpackagesetinclusion_pkey PRIMARY KEY (id);
16740
6352
ALTER TABLE ONLY fticache
16741
6353
ADD CONSTRAINT fticache_pkey PRIMARY KEY (id);
16744
6355
ALTER TABLE ONLY fticache
16745
6356
ADD CONSTRAINT fticache_tablename_key UNIQUE (tablename);
16748
6358
ALTER TABLE ONLY gpgkey
16749
6359
ADD CONSTRAINT gpgkey_fingerprint_key UNIQUE (fingerprint);
16752
6361
ALTER TABLE ONLY gpgkey
16753
6362
ADD CONSTRAINT gpgkey_owner_key UNIQUE (owner, id);
16756
6364
ALTER TABLE ONLY gpgkey
16757
6365
ADD CONSTRAINT gpgkey_pkey PRIMARY KEY (id);
16760
6367
ALTER TABLE ONLY hwdevice
16761
6368
ADD CONSTRAINT hwdevice__bus_vendor_id__bus_product_id__variant__key UNIQUE (bus_vendor_id, bus_product_id, variant);
16764
6370
ALTER TABLE ONLY hwdevice
16765
6371
ADD CONSTRAINT hwdevice_pkey PRIMARY KEY (id);
16768
6373
ALTER TABLE ONLY hwdeviceclass
16769
6374
ADD CONSTRAINT hwdeviceclass_pkey PRIMARY KEY (id);
16772
6376
ALTER TABLE ONLY hwdevicedriverlink
16773
6377
ADD CONSTRAINT hwdevicedriverlink_pkey PRIMARY KEY (id);
16776
6379
ALTER TABLE ONLY hwdevicenamevariant
16777
6380
ADD CONSTRAINT hwdevicenamevariant__vendor_name__product_name__device__key UNIQUE (vendor_name, product_name, device);
16780
6382
ALTER TABLE ONLY hwdevicenamevariant
16781
6383
ADD CONSTRAINT hwdevicenamevariant_pkey PRIMARY KEY (id);
16784
6385
ALTER TABLE ONLY hwdmihandle
16785
6386
ADD CONSTRAINT hwdmihandle_pkey PRIMARY KEY (id);
16788
6388
ALTER TABLE ONLY hwdmivalue
16789
6389
ADD CONSTRAINT hwdmivalue_pkey PRIMARY KEY (id);
16792
6391
ALTER TABLE ONLY hwdriver
16793
6392
ADD CONSTRAINT hwdriver__package_name__name__key UNIQUE (package_name, name);
16796
6394
ALTER TABLE ONLY hwdriver
16797
6395
ADD CONSTRAINT hwdriver_pkey PRIMARY KEY (id);
16800
6397
ALTER TABLE ONLY hwsubmission
16801
6398
ADD CONSTRAINT hwsubmission__submission_key__key UNIQUE (submission_key);
16804
6400
ALTER TABLE ONLY hwsubmission
16805
6401
ADD CONSTRAINT hwsubmission_pkey PRIMARY KEY (id);
16808
6403
ALTER TABLE ONLY hwsubmissionbug
16809
6404
ADD CONSTRAINT hwsubmissionbug__submission__bug__key UNIQUE (submission, bug);
16812
6406
ALTER TABLE ONLY hwsubmissionbug
16813
6407
ADD CONSTRAINT hwsubmissionbug_pkey PRIMARY KEY (id);
16816
6409
ALTER TABLE ONLY hwsubmissiondevice
16817
6410
ADD CONSTRAINT hwsubmissiondevice_pkey PRIMARY KEY (id);
16820
6412
ALTER TABLE ONLY hwsystemfingerprint
16821
6413
ADD CONSTRAINT hwsystemfingerprint__fingerprint__key UNIQUE (fingerprint);
16824
6415
ALTER TABLE ONLY hwsystemfingerprint
16825
6416
ADD CONSTRAINT hwsystemfingerprint_pkey PRIMARY KEY (id);
16828
6418
ALTER TABLE ONLY hwtest
16829
6419
ADD CONSTRAINT hwtest_pkey PRIMARY KEY (id);
16832
6421
ALTER TABLE ONLY hwtestanswer
16833
6422
ADD CONSTRAINT hwtestanswer_pkey PRIMARY KEY (id);
16836
6424
ALTER TABLE ONLY hwtestanswerchoice
16837
6425
ADD CONSTRAINT hwtestanswerchoice__choice__test__key UNIQUE (choice, test);
16840
6427
ALTER TABLE ONLY hwtestanswerchoice
16841
6428
ADD CONSTRAINT hwtestanswerchoice__test__id__key UNIQUE (test, id);
16844
6430
ALTER TABLE ONLY hwtestanswerchoice
16845
6431
ADD CONSTRAINT hwtestanswerchoice_pkey PRIMARY KEY (id);
16848
6433
ALTER TABLE ONLY hwtestanswercount
16849
6434
ADD CONSTRAINT hwtestanswercount_pkey PRIMARY KEY (id);
16852
6436
ALTER TABLE ONLY hwtestanswercountdevice
16853
6437
ADD CONSTRAINT hwtestanswercountdevice__answer__device_driver__key UNIQUE (answer, device_driver);
16856
6439
ALTER TABLE ONLY hwtestanswercountdevice
16857
6440
ADD CONSTRAINT hwtestanswercountdevice_pkey PRIMARY KEY (id);
16860
6442
ALTER TABLE ONLY hwtestanswerdevice
16861
6443
ADD CONSTRAINT hwtestanswerdevice__answer__device_driver__key UNIQUE (answer, device_driver);
16864
6445
ALTER TABLE ONLY hwtestanswerdevice
16865
6446
ADD CONSTRAINT hwtestanswerdevice_pkey PRIMARY KEY (id);
16868
6448
ALTER TABLE ONLY hwvendorid
16869
6449
ADD CONSTRAINT hwvendorid__bus_vendor_id__vendor_name__key UNIQUE (bus, vendor_id_for_bus, vendor_name);
16872
6451
ALTER TABLE ONLY hwvendorid
16873
6452
ADD CONSTRAINT hwvendorid_pkey PRIMARY KEY (id);
16876
6454
ALTER TABLE ONLY hwvendorname
16877
6455
ADD CONSTRAINT hwvendorname_pkey PRIMARY KEY (id);
16880
ALTER TABLE ONLY incrementaldiff
16881
ADD CONSTRAINT incrementaldiff_pkey PRIMARY KEY (id);
16884
6457
ALTER TABLE ONLY ircid
16885
6458
ADD CONSTRAINT ircid_pkey PRIMARY KEY (id);
16888
6460
ALTER TABLE ONLY jabberid
16889
6461
ADD CONSTRAINT jabberid_jabberid_key UNIQUE (jabberid);
16892
6463
ALTER TABLE ONLY jabberid
16893
6464
ADD CONSTRAINT jabberid_pkey PRIMARY KEY (id);
16896
6466
ALTER TABLE ONLY job
16897
6467
ADD CONSTRAINT job__status__id__key UNIQUE (status, id);
16900
6469
ALTER TABLE ONLY job
16901
6470
ADD CONSTRAINT job_pkey PRIMARY KEY (id);
16903
6472
ALTER TABLE job CLUSTER ON job_pkey;
16906
6474
ALTER TABLE ONLY karma
16907
6475
ADD CONSTRAINT karma_pkey PRIMARY KEY (id);
16910
6477
ALTER TABLE ONLY karmaaction
16911
6478
ADD CONSTRAINT karmaaction_name_uniq UNIQUE (name);
16914
6480
ALTER TABLE ONLY karmaaction
16915
6481
ADD CONSTRAINT karmaaction_pkey PRIMARY KEY (id);
16918
6483
ALTER TABLE ONLY karmacache
16919
6484
ADD CONSTRAINT karmacache_pkey PRIMARY KEY (id);
16922
6486
ALTER TABLE ONLY karmacategory
16923
6487
ADD CONSTRAINT karmacategory_pkey PRIMARY KEY (id);
16926
6489
ALTER TABLE ONLY karmatotalcache
16927
6490
ADD CONSTRAINT karmatotalcache_person_key UNIQUE (person);
16930
6492
ALTER TABLE ONLY karmatotalcache
16931
6493
ADD CONSTRAINT karmatotalcache_pkey PRIMARY KEY (id);
16934
6495
ALTER TABLE ONLY language
16935
6496
ADD CONSTRAINT language_code_key UNIQUE (code);
16938
6498
ALTER TABLE ONLY language
16939
6499
ADD CONSTRAINT language_pkey PRIMARY KEY (id);
16942
6501
ALTER TABLE ONLY languagepack
16943
6502
ADD CONSTRAINT languagepack_pkey PRIMARY KEY (id);
16946
6504
ALTER TABLE ONLY launchpaddatabaserevision
16947
6505
ADD CONSTRAINT launchpaddatabaserevision_pkey PRIMARY KEY (major, minor, patch);
16950
ALTER TABLE ONLY launchpaddatabaseupdatelog
16951
ADD CONSTRAINT launchpaddatabaseupdatelog_pkey PRIMARY KEY (id);
16954
6507
ALTER TABLE ONLY launchpadstatistic
16955
6508
ADD CONSTRAINT launchpadstatistic_pkey PRIMARY KEY (id);
16958
6510
ALTER TABLE ONLY launchpadstatistic
16959
6511
ADD CONSTRAINT launchpadstatistics_uniq_name UNIQUE (name);
16962
6513
ALTER TABLE ONLY libraryfilealias
16963
6514
ADD CONSTRAINT libraryfilealias_pkey PRIMARY KEY (id);
16965
6516
ALTER TABLE libraryfilealias CLUSTER ON libraryfilealias_pkey;
16968
6518
ALTER TABLE ONLY libraryfilecontent
16969
6519
ADD CONSTRAINT libraryfilecontent_pkey PRIMARY KEY (id);
16971
6521
ALTER TABLE libraryfilecontent CLUSTER ON libraryfilecontent_pkey;
16974
6523
ALTER TABLE ONLY libraryfiledownloadcount
16975
6524
ADD CONSTRAINT libraryfiledownloadcount__libraryfilealias__day__country__key UNIQUE (libraryfilealias, day, country);
16978
6526
ALTER TABLE ONLY libraryfiledownloadcount
16979
6527
ADD CONSTRAINT libraryfiledownloadcount_pkey PRIMARY KEY (id);
16982
6529
ALTER TABLE ONLY logintoken
16983
6530
ADD CONSTRAINT logintoken_pkey PRIMARY KEY (id);
16986
6532
ALTER TABLE ONLY logintoken
16987
6533
ADD CONSTRAINT logintoken_token_key UNIQUE (token);
16990
6535
ALTER TABLE ONLY lp_account
16991
6536
ADD CONSTRAINT lp_account__openid_identifier__key UNIQUE (openid_identifier);
16994
6538
ALTER TABLE ONLY lp_account
16995
6539
ADD CONSTRAINT lp_account_pkey PRIMARY KEY (id);
16998
ALTER TABLE ONLY lp_openididentifier
16999
ADD CONSTRAINT lp_openididentifier_pkey PRIMARY KEY (identifier);
17002
6541
ALTER TABLE ONLY lp_person
17003
6542
ADD CONSTRAINT lp_person__account__key UNIQUE (account);
17006
6544
ALTER TABLE ONLY lp_person
17007
6545
ADD CONSTRAINT lp_person__name__key UNIQUE (name);
17010
6547
ALTER TABLE ONLY lp_person
17011
6548
ADD CONSTRAINT lp_person_pkey PRIMARY KEY (id);
17014
6550
ALTER TABLE ONLY lp_personlocation
17015
6551
ADD CONSTRAINT lp_personlocation__person__key UNIQUE (person);
17018
6553
ALTER TABLE ONLY lp_personlocation
17019
6554
ADD CONSTRAINT lp_personlocation_pkey PRIMARY KEY (id);
17022
6556
ALTER TABLE ONLY lp_teamparticipation
17023
6557
ADD CONSTRAINT lp_teamparticipation_pkey PRIMARY KEY (id);
17026
6559
ALTER TABLE ONLY lp_teamparticipation
17027
6560
ADD CONSTRAINT lp_teamperticipation__team__person__key UNIQUE (team, person);
17030
6562
ALTER TABLE ONLY mailinglist
17031
6563
ADD CONSTRAINT mailinglist_pkey PRIMARY KEY (id);
17034
6565
ALTER TABLE ONLY mailinglist
17035
6566
ADD CONSTRAINT mailinglist_team_key UNIQUE (team);
6568
ALTER TABLE ONLY mailinglistban
6569
ADD CONSTRAINT mailinglistban_pkey PRIMARY KEY (id);
17038
6571
ALTER TABLE ONLY mailinglistsubscription
17039
6572
ADD CONSTRAINT mailinglistsubscription_pkey PRIMARY KEY (id);
17042
6574
ALTER TABLE ONLY teammembership
17043
6575
ADD CONSTRAINT membership_person_key UNIQUE (person, team);
17046
6577
ALTER TABLE ONLY teammembership
17047
6578
ADD CONSTRAINT membership_pkey PRIMARY KEY (id);
6580
ALTER TABLE ONLY mentoringoffer
6581
ADD CONSTRAINT mentoringoffer_pkey PRIMARY KEY (id);
17050
6583
ALTER TABLE ONLY mergedirectivejob
17051
6584
ADD CONSTRAINT mergedirectivejob_job_key UNIQUE (job);
17054
6586
ALTER TABLE ONLY mergedirectivejob
17055
6587
ADD CONSTRAINT mergedirectivejob_pkey PRIMARY KEY (id);
17058
6589
ALTER TABLE ONLY message
17059
6590
ADD CONSTRAINT message_pkey PRIMARY KEY (id);
17061
ALTER TABLE message CLUSTER ON message_pkey;
17064
6592
ALTER TABLE ONLY messageapproval
17065
6593
ADD CONSTRAINT messageapproval_pkey PRIMARY KEY (id);
17068
6595
ALTER TABLE ONLY messagechunk
17069
6596
ADD CONSTRAINT messagechunk_message_idx UNIQUE (message, sequence);
17072
6598
ALTER TABLE ONLY messagechunk
17073
6599
ADD CONSTRAINT messagechunk_pkey PRIMARY KEY (id);
17076
6601
ALTER TABLE ONLY milestone
17077
6602
ADD CONSTRAINT milestone_distribution_id_key UNIQUE (distribution, id);
17080
6604
ALTER TABLE ONLY milestone
17081
6605
ADD CONSTRAINT milestone_name_distribution_key UNIQUE (name, distribution);
17084
6607
ALTER TABLE ONLY milestone
17085
6608
ADD CONSTRAINT milestone_name_product_key UNIQUE (name, product);
17088
6610
ALTER TABLE ONLY milestone
17089
6611
ADD CONSTRAINT milestone_pkey PRIMARY KEY (id);
17091
6613
ALTER TABLE milestone CLUSTER ON milestone_pkey;
17094
6615
ALTER TABLE ONLY milestone
17095
6616
ADD CONSTRAINT milestone_product_id_key UNIQUE (product, id);
17098
6618
ALTER TABLE ONLY mirror
17099
6619
ADD CONSTRAINT mirror_name_key UNIQUE (name);
17102
6621
ALTER TABLE ONLY mirror
17103
6622
ADD CONSTRAINT mirror_pkey PRIMARY KEY (id);
17106
6624
ALTER TABLE ONLY mirrorcdimagedistroseries
17107
6625
ADD CONSTRAINT mirrorcdimagedistrorelease_pkey PRIMARY KEY (id);
17110
6627
ALTER TABLE ONLY mirrorcdimagedistroseries
17111
6628
ADD CONSTRAINT mirrorcdimagedistroseries__unq UNIQUE (distroseries, flavour, distribution_mirror);
17114
6630
ALTER TABLE ONLY mirrorcontent
17115
6631
ADD CONSTRAINT mirrorcontent_pkey PRIMARY KEY (id);
17118
6633
ALTER TABLE ONLY mirrordistroarchseries
17119
6634
ADD CONSTRAINT mirrordistroarchrelease_pkey PRIMARY KEY (id);
17122
6636
ALTER TABLE ONLY mirrordistroseriessource
17123
6637
ADD CONSTRAINT mirrordistroreleasesource_pkey PRIMARY KEY (id);
17126
6639
ALTER TABLE ONLY mirrorproberecord
17127
6640
ADD CONSTRAINT mirrorproberecord_pkey PRIMARY KEY (id);
17130
6642
ALTER TABLE ONLY mirrorsourcecontent
17131
6643
ADD CONSTRAINT mirrorsourcecontent_pkey PRIMARY KEY (id);
17134
6645
ALTER TABLE ONLY nameblacklist
17135
6646
ADD CONSTRAINT nameblacklist__regexp__key UNIQUE (regexp);
17138
6648
ALTER TABLE ONLY nameblacklist
17139
6649
ADD CONSTRAINT nameblacklist_pkey PRIMARY KEY (id);
17142
6651
ALTER TABLE ONLY oauthaccesstoken
17143
6652
ADD CONSTRAINT oauthaccesstoken_key_key UNIQUE (key);
17146
6654
ALTER TABLE ONLY oauthaccesstoken
17147
6655
ADD CONSTRAINT oauthaccesstoken_pkey PRIMARY KEY (id);
17150
6657
ALTER TABLE ONLY oauthconsumer
17151
6658
ADD CONSTRAINT oauthconsumer_key_key UNIQUE (key);
17154
6660
ALTER TABLE ONLY oauthconsumer
17155
6661
ADD CONSTRAINT oauthconsumer_pkey PRIMARY KEY (id);
17158
ALTER TABLE ONLY oauthnonce
17159
ADD CONSTRAINT oauthnonce_pkey PRIMARY KEY (access_token, request_timestamp, nonce);
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;
17162
6671
ALTER TABLE ONLY oauthrequesttoken
17163
6672
ADD CONSTRAINT oauthrequesttoken_key_key UNIQUE (key);
17166
6674
ALTER TABLE ONLY oauthrequesttoken
17167
6675
ADD CONSTRAINT oauthrequesttoken_pkey PRIMARY KEY (id);
17170
6677
ALTER TABLE ONLY officialbugtag
17171
6678
ADD CONSTRAINT officialbugtag_pkey PRIMARY KEY (id);
6680
ALTER TABLE ONLY openidassociation
6681
ADD CONSTRAINT openidassociation_pkey PRIMARY KEY (server_url, handle);
17174
6683
ALTER TABLE ONLY openidconsumerassociation
17175
6684
ADD CONSTRAINT openidconsumerassociation_pkey PRIMARY KEY (server_url, handle);
17178
6686
ALTER TABLE ONLY openidconsumernonce
17179
6687
ADD CONSTRAINT openidconsumernonce_pkey PRIMARY KEY (server_url, "timestamp", salt);
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);
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);
17190
6704
ALTER TABLE ONLY packagebuild
17191
6705
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);
17202
6707
ALTER TABLE ONLY packagecopyrequest
17203
6708
ADD CONSTRAINT packagecopyrequest_pkey PRIMARY KEY (id);
17206
6710
ALTER TABLE ONLY packagediff
17207
6711
ADD CONSTRAINT packagediff_pkey PRIMARY KEY (id);
17210
6713
ALTER TABLE ONLY packagesetinclusion
17211
6714
ADD CONSTRAINT packagepayerinclusion__parent__child__key UNIQUE (parent, child);
17214
6716
ALTER TABLE ONLY binarypackagepublishinghistory
17215
6717
ADD CONSTRAINT packagepublishinghistory_pkey PRIMARY KEY (id);
6719
ALTER TABLE ONLY packageselection
6720
ADD CONSTRAINT packageselection_pkey PRIMARY KEY (id);
17218
6722
ALTER TABLE ONLY packageset
17219
6723
ADD CONSTRAINT packageset__name__distroseries__key UNIQUE (name, distroseries);
17222
6725
ALTER TABLE ONLY packageset
17223
6726
ADD CONSTRAINT packageset_pkey PRIMARY KEY (id);
17226
6728
ALTER TABLE ONLY packagesetgroup
17227
6729
ADD CONSTRAINT packagesetgroup_pkey PRIMARY KEY (id);
17230
6731
ALTER TABLE ONLY packagesetinclusion
17231
6732
ADD CONSTRAINT packagesetinclusion_pkey PRIMARY KEY (id);
17234
6734
ALTER TABLE ONLY packagesetsources
17235
6735
ADD CONSTRAINT packagesetsources__packageset__sourcepackagename__key UNIQUE (packageset, sourcepackagename);
17238
6737
ALTER TABLE ONLY packagesetsources
17239
6738
ADD CONSTRAINT packagesetsources_pkey PRIMARY KEY (id);
17242
6740
ALTER TABLE ONLY packageuploadsource
17243
6741
ADD CONSTRAINT packageuploadsource__packageupload__key UNIQUE (packageupload);
17246
6743
ALTER TABLE ONLY packaging
17247
6744
ADD CONSTRAINT packaging__distroseries__sourcepackagename__key UNIQUE (distroseries, sourcepackagename);
17250
6746
ALTER TABLE ONLY packaging
17251
6747
ADD CONSTRAINT packaging_pkey PRIMARY KEY (id);
17254
ALTER TABLE ONLY packagingjob
17255
ADD CONSTRAINT packagingjob_pkey PRIMARY KEY (id);
17258
6749
ALTER TABLE ONLY parsedapachelog
17259
6750
ADD CONSTRAINT parsedapachelog_pkey PRIMARY KEY (id);
17262
6752
ALTER TABLE ONLY person
17263
6753
ADD CONSTRAINT person__account__key UNIQUE (account);
17266
6755
ALTER TABLE ONLY person
17267
6756
ADD CONSTRAINT person__name__key UNIQUE (name);
17270
6758
ALTER TABLE ONLY person
17271
6759
ADD CONSTRAINT person_pkey PRIMARY KEY (id);
17273
6761
ALTER TABLE person CLUSTER ON person_pkey;
17276
6763
ALTER TABLE ONLY personlanguage
17277
6764
ADD CONSTRAINT personlanguage_person_key UNIQUE (person, language);
17280
6766
ALTER TABLE ONLY personlanguage
17281
6767
ADD CONSTRAINT personlanguage_pkey PRIMARY KEY (id);
17284
6769
ALTER TABLE ONLY personlocation
17285
6770
ADD CONSTRAINT personlocation_person_key UNIQUE (person);
17288
6772
ALTER TABLE ONLY personlocation
17289
6773
ADD CONSTRAINT personlocation_pkey PRIMARY KEY (id);
17292
6775
ALTER TABLE ONLY personnotification
17293
6776
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);
17308
6778
ALTER TABLE ONLY pillarname
17309
6779
ADD CONSTRAINT pillarname_name_key UNIQUE (name);
17312
6781
ALTER TABLE ONLY pillarname
17313
6782
ADD CONSTRAINT pillarname_pkey PRIMARY KEY (id);
17315
6784
ALTER TABLE pillarname CLUSTER ON pillarname_pkey;
17318
6786
ALTER TABLE ONLY pocketchroot
17319
6787
ADD CONSTRAINT pocketchroot_distroarchrelease_key UNIQUE (distroarchseries, pocket);
17322
6789
ALTER TABLE ONLY pocketchroot
17323
6790
ADD CONSTRAINT pocketchroot_pkey PRIMARY KEY (id);
6792
ALTER TABLE ONLY pocomment
6793
ADD CONSTRAINT pocomment_pkey PRIMARY KEY (id);
17326
6795
ALTER TABLE ONLY poexportrequest
17327
6796
ADD CONSTRAINT poexportrequest_pkey PRIMARY KEY (id);
17330
6798
ALTER TABLE ONLY pofile
17331
6799
ADD CONSTRAINT pofile_pkey PRIMARY KEY (id);
17334
ALTER TABLE ONLY pofilestatsjob
17335
ADD CONSTRAINT pofilestatsjob_pkey PRIMARY KEY (job);
17338
6801
ALTER TABLE ONLY pofiletranslator
17339
6802
ADD CONSTRAINT pofiletranslator__person__pofile__key UNIQUE (person, pofile);
17341
6804
ALTER TABLE pofiletranslator CLUSTER ON pofiletranslator__person__pofile__key;
17344
6806
ALTER TABLE ONLY pofiletranslator
17345
6807
ADD CONSTRAINT pofiletranslator_pkey PRIMARY KEY (id);
17348
6809
ALTER TABLE ONLY poll
17349
6810
ADD CONSTRAINT poll_pkey PRIMARY KEY (id);
17352
6812
ALTER TABLE ONLY poll
17353
6813
ADD CONSTRAINT poll_team_key UNIQUE (team, name);
17356
6815
ALTER TABLE ONLY polloption
17357
6816
ADD CONSTRAINT polloption_name_key UNIQUE (name, poll);
17360
6818
ALTER TABLE ONLY polloption
17361
6819
ADD CONSTRAINT polloption_pkey PRIMARY KEY (id);
17364
6821
ALTER TABLE ONLY polloption
17365
6822
ADD CONSTRAINT polloption_poll_key UNIQUE (poll, id);
17368
6824
ALTER TABLE ONLY pomsgid
17369
6825
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);
17372
6833
ALTER TABLE ONLY potemplate
17373
6834
ADD CONSTRAINT potemplate_pkey PRIMARY KEY (id);
17376
6836
ALTER TABLE ONLY potmsgset
17377
6837
ADD CONSTRAINT potmsgset_pkey PRIMARY KEY (id);
17380
6839
ALTER TABLE ONLY potranslation
17381
6840
ADD CONSTRAINT potranslation_pkey PRIMARY KEY (id);
17384
6842
ALTER TABLE ONLY previewdiff
17385
6843
ADD CONSTRAINT previewdiff_pkey PRIMARY KEY (id);
17388
6845
ALTER TABLE ONLY processor
17389
6846
ADD CONSTRAINT processor_name_key UNIQUE (name);
17392
6848
ALTER TABLE ONLY processor
17393
6849
ADD CONSTRAINT processor_pkey PRIMARY KEY (id);
17396
6851
ALTER TABLE ONLY processorfamily
17397
6852
ADD CONSTRAINT processorfamily_name_key UNIQUE (name);
17400
6854
ALTER TABLE ONLY processorfamily
17401
6855
ADD CONSTRAINT processorfamily_pkey PRIMARY KEY (id);
17404
6857
ALTER TABLE ONLY product
17405
6858
ADD CONSTRAINT product_name_key UNIQUE (name);
17407
ALTER TABLE product CLUSTER ON product_name_key;
17410
6860
ALTER TABLE ONLY product
17411
6861
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);
17414
6872
ALTER TABLE ONLY productlicense
17415
6873
ADD CONSTRAINT productlicense__product__license__key UNIQUE (product, license);
17418
6875
ALTER TABLE ONLY productlicense
17419
6876
ADD CONSTRAINT productlicense_pkey PRIMARY KEY (id);
17422
6878
ALTER TABLE ONLY productrelease
17423
6879
ADD CONSTRAINT productrelease_milestone_key UNIQUE (milestone);
17426
6881
ALTER TABLE ONLY productrelease
17427
6882
ADD CONSTRAINT productrelease_pkey PRIMARY KEY (id);
17429
6884
ALTER TABLE productrelease CLUSTER ON productrelease_pkey;
17432
6886
ALTER TABLE ONLY productreleasefile
17433
6887
ADD CONSTRAINT productreleasefile_pkey PRIMARY KEY (id);
17436
6889
ALTER TABLE ONLY productseries
17437
6890
ADD CONSTRAINT productseries__product__name__key UNIQUE (product, name);
17439
6892
ALTER TABLE productseries CLUSTER ON productseries__product__name__key;
17442
6894
ALTER TABLE ONLY productseries
17443
6895
ADD CONSTRAINT productseries_pkey PRIMARY KEY (id);
17446
6897
ALTER TABLE ONLY productseries
17447
6898
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);
17450
6912
ALTER TABLE ONLY project
17451
6913
ADD CONSTRAINT project_name_key UNIQUE (name);
17454
6915
ALTER TABLE ONLY project
17455
6916
ADD CONSTRAINT project_pkey PRIMARY KEY (id);
17457
6918
ALTER TABLE project CLUSTER ON project_pkey;
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);
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);
17472
6944
ALTER TABLE ONLY revision
17473
6945
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);
17476
6950
ALTER TABLE ONLY revision
17477
6951
ADD CONSTRAINT revision_revision_id_unique UNIQUE (revision_id);
17480
6953
ALTER TABLE ONLY revisioncache
17481
6954
ADD CONSTRAINT revisioncache_pkey PRIMARY KEY (id);
6956
ALTER TABLE ONLY branchrevision
6957
ADD CONSTRAINT revisionnumber_branch_id_unique UNIQUE (branch, id);
17484
6959
ALTER TABLE ONLY branchrevision
17485
6960
ADD CONSTRAINT revisionnumber_branch_sequence_unique UNIQUE (branch, sequence);
17488
6962
ALTER TABLE ONLY branchrevision
17489
ADD CONSTRAINT revisionnumber_pkey PRIMARY KEY (revision, branch);
6963
ADD CONSTRAINT revisionnumber_pkey PRIMARY KEY (id);
17492
6965
ALTER TABLE ONLY revisionparent
17493
6966
ADD CONSTRAINT revisionparent_pkey PRIMARY KEY (id);
17496
6968
ALTER TABLE ONLY revisionparent
17497
6969
ADD CONSTRAINT revisionparent_unique UNIQUE (revision, parent_id);
17500
6971
ALTER TABLE ONLY revisionproperty
17501
6972
ADD CONSTRAINT revisionproperty__revision__name__key UNIQUE (revision, name);
17504
6974
ALTER TABLE ONLY revisionproperty
17505
6975
ADD CONSTRAINT revisionproperty_pkey PRIMARY KEY (id);
17508
6977
ALTER TABLE ONLY scriptactivity
17509
6978
ADD CONSTRAINT scriptactivity_pkey PRIMARY KEY (id);
17512
6980
ALTER TABLE ONLY section
17513
6981
ADD CONSTRAINT section_name_key UNIQUE (name);
17516
6983
ALTER TABLE ONLY section
17517
6984
ADD CONSTRAINT section_pkey PRIMARY KEY (id);
17520
6986
ALTER TABLE ONLY sectionselection
17521
6987
ADD CONSTRAINT sectionselection_pkey PRIMARY KEY (id);
17524
6989
ALTER TABLE ONLY seriessourcepackagebranch
17525
6990
ADD CONSTRAINT seriessourcepackagebranch__ds__spn__pocket__key UNIQUE (distroseries, sourcepackagename, pocket);
17528
6992
ALTER TABLE ONLY seriessourcepackagebranch
17529
6993
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);
17532
7034
ALTER TABLE ONLY signedcodeofconduct
17533
7035
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);
17536
7043
ALTER TABLE ONLY sourcepackageformatselection
17537
7044
ADD CONSTRAINT sourceformatselection__distroseries__format__key UNIQUE (distroseries, format);
17540
7046
ALTER TABLE ONLY sourcepackageformatselection
17541
7047
ADD CONSTRAINT sourcepackageformatselection_pkey PRIMARY KEY (id);
17544
7049
ALTER TABLE ONLY sourcepackagename
17545
7050
ADD CONSTRAINT sourcepackagename_name_key UNIQUE (name);
17548
7052
ALTER TABLE ONLY sourcepackagename
17549
7053
ADD CONSTRAINT sourcepackagename_pkey PRIMARY KEY (id);
17552
7055
ALTER TABLE ONLY sourcepackagepublishinghistory
17553
7056
ADD CONSTRAINT sourcepackagepublishinghistory_pkey PRIMARY KEY (id);
17556
7058
ALTER TABLE ONLY sourcepackagerecipe
17557
7059
ADD CONSTRAINT sourcepackagerecipe__owner__name__key UNIQUE (owner, name);
17560
7061
ALTER TABLE ONLY sourcepackagerecipedistroseries
17561
7062
ADD CONSTRAINT sourcepackagerecipe_distroseries_unique UNIQUE (sourcepackagerecipe, distroseries);
17564
7064
ALTER TABLE ONLY sourcepackagerecipe
17565
7065
ADD CONSTRAINT sourcepackagerecipe_pkey PRIMARY KEY (id);
17568
7067
ALTER TABLE ONLY sourcepackagerecipebuild
17569
7068
ADD CONSTRAINT sourcepackagerecipebuild_pkey PRIMARY KEY (id);
17572
7070
ALTER TABLE ONLY sourcepackagerecipebuildjob
17573
7071
ADD CONSTRAINT sourcepackagerecipebuildjob__job__key UNIQUE (job);
17576
7073
ALTER TABLE ONLY sourcepackagerecipebuildjob
17577
7074
ADD CONSTRAINT sourcepackagerecipebuildjob__sourcepackage_recipe_build__key UNIQUE (sourcepackage_recipe_build);
17580
7076
ALTER TABLE ONLY sourcepackagerecipebuildjob
17581
7077
ADD CONSTRAINT sourcepackagerecipebuildjob_pkey PRIMARY KEY (id);
17584
7079
ALTER TABLE ONLY sourcepackagerecipedata
17585
7080
ADD CONSTRAINT sourcepackagerecipedata_pkey PRIMARY KEY (id);
17588
7082
ALTER TABLE ONLY sourcepackagerecipedatainstruction
17589
7083
ADD CONSTRAINT sourcepackagerecipedatainstruction__name__recipe_data__key UNIQUE (name, recipe_data);
17592
7085
ALTER TABLE ONLY sourcepackagerecipedatainstruction
17593
7086
ADD CONSTRAINT sourcepackagerecipedatainstruction__recipe_data__line_number__k UNIQUE (recipe_data, line_number);
17596
7088
ALTER TABLE ONLY sourcepackagerecipedatainstruction
17597
7089
ADD CONSTRAINT sourcepackagerecipedatainstruction_pkey PRIMARY KEY (id);
17600
7091
ALTER TABLE ONLY sourcepackagerecipedistroseries
17601
7092
ADD CONSTRAINT sourcepackagerecipedistroseries_pkey PRIMARY KEY (id);
17604
7094
ALTER TABLE ONLY sourcepackagerelease
17605
7095
ADD CONSTRAINT sourcepackagerelease_pkey PRIMARY KEY (id);
17608
7097
ALTER TABLE ONLY sourcepackagereleasefile
17609
7098
ADD CONSTRAINT sourcepackagereleasefile_pkey PRIMARY KEY (id);
17612
7100
ALTER TABLE ONLY specificationbug
17613
7101
ADD CONSTRAINT specification_bug_uniq UNIQUE (specification, bug);
17616
7103
ALTER TABLE ONLY specification
17617
7104
ADD CONSTRAINT specification_distribution_name_uniq UNIQUE (distribution, name);
17620
7106
ALTER TABLE ONLY specification
17621
7107
ADD CONSTRAINT specification_pkey PRIMARY KEY (id);
17624
7109
ALTER TABLE ONLY specification
17625
7110
ADD CONSTRAINT specification_product_name_uniq UNIQUE (name, product);
17628
7112
ALTER TABLE ONLY specification
17629
7113
ADD CONSTRAINT specification_specurl_uniq UNIQUE (specurl);
17632
7115
ALTER TABLE ONLY specificationbranch
17633
7116
ADD CONSTRAINT specificationbranch__spec_branch_unique UNIQUE (branch, specification);
17636
7118
ALTER TABLE ONLY specificationbranch
17637
7119
ADD CONSTRAINT specificationbranch_pkey PRIMARY KEY (id);
17640
7121
ALTER TABLE ONLY specificationbug
17641
7122
ADD CONSTRAINT specificationbug_pkey PRIMARY KEY (id);
17644
7124
ALTER TABLE ONLY specificationdependency
17645
7125
ADD CONSTRAINT specificationdependency_pkey PRIMARY KEY (id);
17648
7127
ALTER TABLE ONLY specificationdependency
17649
7128
ADD CONSTRAINT specificationdependency_uniq UNIQUE (specification, dependency);
17652
7130
ALTER TABLE ONLY specificationfeedback
17653
7131
ADD CONSTRAINT specificationfeedback_pkey PRIMARY KEY (id);
17656
7133
ALTER TABLE ONLY specificationmessage
17657
7134
ADD CONSTRAINT specificationmessage__specification__message__key UNIQUE (specification, message);
17660
7136
ALTER TABLE ONLY specificationmessage
17661
7137
ADD CONSTRAINT specificationmessage_pkey PRIMARY KEY (id);
17664
7139
ALTER TABLE ONLY specificationsubscription
17665
7140
ADD CONSTRAINT specificationsubscription_pkey PRIMARY KEY (id);
17668
7142
ALTER TABLE ONLY specificationsubscription
17669
7143
ADD CONSTRAINT specificationsubscription_spec_person_uniq UNIQUE (specification, person);
17672
7145
ALTER TABLE ONLY spokenin
17673
7146
ADD CONSTRAINT spokenin__country__language__key UNIQUE (language, country);
17676
7148
ALTER TABLE ONLY spokenin
17677
7149
ADD CONSTRAINT spokenin_pkey PRIMARY KEY (id);
17680
7151
ALTER TABLE ONLY sprint
17681
7152
ADD CONSTRAINT sprint_name_uniq UNIQUE (name);
17684
7154
ALTER TABLE ONLY sprint
17685
7155
ADD CONSTRAINT sprint_pkey PRIMARY KEY (id);
17688
7157
ALTER TABLE ONLY sprintattendance
17689
7158
ADD CONSTRAINT sprintattendance_attendance_uniq UNIQUE (attendee, sprint);
17692
7160
ALTER TABLE ONLY sprintattendance
17693
7161
ADD CONSTRAINT sprintattendance_pkey PRIMARY KEY (id);
17696
7163
ALTER TABLE ONLY sprintspecification
17697
7164
ADD CONSTRAINT sprintspec_uniq UNIQUE (specification, sprint);
17700
7166
ALTER TABLE ONLY sprintspecification
17701
7167
ADD CONSTRAINT sprintspecification_pkey PRIMARY KEY (id);
17704
7169
ALTER TABLE ONLY sshkey
17705
7170
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);
17708
7184
ALTER TABLE ONLY structuralsubscription
17709
7185
ADD CONSTRAINT structuralsubscription_pkey PRIMARY KEY (id);
17712
ALTER TABLE ONLY subunitstream
17713
ADD CONSTRAINT subunitstream_pkey PRIMARY KEY (id);
17716
7187
ALTER TABLE ONLY suggestivepotemplate
17717
7188
ADD CONSTRAINT suggestivepotemplate_pkey PRIMARY KEY (potemplate);
17720
7190
ALTER TABLE ONLY answercontact
17721
7191
ADD CONSTRAINT supportcontact__distribution__sourcepackagename__person__key UNIQUE (distribution, sourcepackagename, person);
17724
7193
ALTER TABLE ONLY answercontact
17725
7194
ADD CONSTRAINT supportcontact__product__person__key UNIQUE (product, person);
17728
7196
ALTER TABLE ONLY answercontact
17729
7197
ADD CONSTRAINT supportcontact_pkey PRIMARY KEY (id);
17732
7199
ALTER TABLE ONLY teamparticipation
17733
7200
ADD CONSTRAINT teamparticipation_pkey PRIMARY KEY (id);
17736
7202
ALTER TABLE ONLY teamparticipation
17737
7203
ADD CONSTRAINT teamparticipation_team_key UNIQUE (team, person);
17740
7205
ALTER TABLE ONLY temporaryblobstorage
17741
7206
ADD CONSTRAINT temporaryblobstorage_file_alias_key UNIQUE (file_alias);
17744
7208
ALTER TABLE ONLY temporaryblobstorage
17745
7209
ADD CONSTRAINT temporaryblobstorage_pkey PRIMARY KEY (id);
17747
7211
ALTER TABLE temporaryblobstorage CLUSTER ON temporaryblobstorage_pkey;
17750
7213
ALTER TABLE ONLY temporaryblobstorage
17751
7214
ADD CONSTRAINT temporaryblobstorage_uuid_key UNIQUE (uuid);
17754
7216
ALTER TABLE ONLY question
17755
7217
ADD CONSTRAINT ticket_pkey PRIMARY KEY (id);
17758
7219
ALTER TABLE ONLY questionbug
17759
7220
ADD CONSTRAINT ticketbug_bug_ticket_uniq UNIQUE (bug, question);
17762
7222
ALTER TABLE ONLY questionbug
17763
7223
ADD CONSTRAINT ticketbug_pkey PRIMARY KEY (id);
17766
7225
ALTER TABLE ONLY questionmessage
17767
7226
ADD CONSTRAINT ticketmessage_message_ticket_uniq UNIQUE (message, question);
17770
7228
ALTER TABLE ONLY questionmessage
17771
7229
ADD CONSTRAINT ticketmessage_pkey PRIMARY KEY (id);
17774
7231
ALTER TABLE ONLY questionreopening
17775
7232
ADD CONSTRAINT ticketreopening_pkey PRIMARY KEY (id);
17778
7234
ALTER TABLE ONLY questionsubscription
17779
7235
ADD CONSTRAINT ticketsubscription_pkey PRIMARY KEY (id);
17782
7237
ALTER TABLE ONLY questionsubscription
17783
7238
ADD CONSTRAINT ticketsubscription_ticket_person_uniq UNIQUE (question, person);
17786
7240
ALTER TABLE ONLY translator
17787
7241
ADD CONSTRAINT translation_translationgroup_key UNIQUE (translationgroup, language);
17790
7243
ALTER TABLE ONLY translationgroup
17791
7244
ADD CONSTRAINT translationgroup_name_key UNIQUE (name);
17794
7246
ALTER TABLE ONLY translationgroup
17795
7247
ADD CONSTRAINT translationgroup_pkey PRIMARY KEY (id);
17798
7249
ALTER TABLE ONLY translationimportqueueentry
17799
7250
ADD CONSTRAINT translationimportqueueentry_pkey PRIMARY KEY (id);
17802
7252
ALTER TABLE ONLY translationmessage
17803
7253
ADD CONSTRAINT translationmessage_pkey PRIMARY KEY (id);
17806
7255
ALTER TABLE ONLY translationrelicensingagreement
17807
7256
ADD CONSTRAINT translationrelicensingagreement__person__key UNIQUE (person);
17810
7258
ALTER TABLE ONLY translationrelicensingagreement
17811
7259
ADD CONSTRAINT translationrelicensingagreement_pkey PRIMARY KEY (id);
17814
7261
ALTER TABLE ONLY translationtemplateitem
17815
7262
ADD CONSTRAINT translationtemplateitem_pkey PRIMARY KEY (id);
17818
ALTER TABLE ONLY translationtemplatesbuild
17819
ADD CONSTRAINT translationtemplatesbuild_pkey PRIMARY KEY (id);
17822
7264
ALTER TABLE ONLY translator
17823
7265
ADD CONSTRAINT translator_pkey PRIMARY KEY (id);
17826
7267
ALTER TABLE ONLY specificationfeedback
17827
7268
ADD CONSTRAINT unique_spec_requestor_provider UNIQUE (specification, requester, reviewer);
17830
7270
ALTER TABLE ONLY usertouseremail
17831
7271
ADD CONSTRAINT usertouseremail_pkey PRIMARY KEY (id);
17834
7273
ALTER TABLE ONLY vote
17835
7274
ADD CONSTRAINT vote_pkey PRIMARY KEY (id);
17838
7276
ALTER TABLE ONLY votecast
17839
7277
ADD CONSTRAINT votecast_person_key UNIQUE (person, poll);
17842
7279
ALTER TABLE ONLY votecast
17843
7280
ADD CONSTRAINT votecast_pkey PRIMARY KEY (id);
7282
ALTER TABLE ONLY webserviceban
7283
ADD CONSTRAINT webserviceban_pkey PRIMARY KEY (id);
17846
7285
ALTER TABLE ONLY wikiname
17847
7286
ADD CONSTRAINT wikiname_pkey PRIMARY KEY (id);
17850
7288
ALTER TABLE ONLY wikiname
17851
7289
ADD CONSTRAINT wikiname_wikiname_key UNIQUE (wikiname, wiki);
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);
7291
CREATE INDEX account__old_openid_identifier__idx ON account USING btree (old_openid_identifier);
17881
7293
CREATE INDEX announcement__distribution__active__idx ON announcement USING btree (distribution, active) WHERE (distribution IS NOT NULL);
17884
7295
CREATE INDEX announcement__product__active__idx ON announcement USING btree (product, active) WHERE (product IS NOT NULL);
17887
7297
CREATE INDEX announcement__project__active__idx ON announcement USING btree (project, active) WHERE (project IS NOT NULL);
17890
7299
CREATE INDEX announcement__registrant__idx ON announcement USING btree (registrant);
17893
7301
CREATE UNIQUE INDEX answercontact__distribution__person__key ON answercontact USING btree (distribution, person) WHERE (sourcepackagename IS NULL);
17896
7303
CREATE INDEX answercontact__person__idx ON answercontact USING btree (person);
17899
7305
CREATE INDEX apportjob__blob__idx ON apportjob USING btree (blob);
7307
CREATE INDEX archive__commercial__idx ON archive USING btree (commercial);
17902
7309
CREATE UNIQUE INDEX archive__distribution__purpose__key ON archive USING btree (distribution, purpose) WHERE (purpose = ANY (ARRAY[1, 4]));
17905
7311
CREATE INDEX archive__owner__idx ON archive USING btree (owner);
17908
7313
CREATE UNIQUE INDEX archive__owner__key ON archive USING btree (owner, distribution, name);
17911
7315
CREATE INDEX archive__require_virtualized__idx ON archive USING btree (require_virtualized);
17914
7317
CREATE INDEX archive__signing_key__idx ON archive USING btree (signing_key) WHERE (signing_key IS NOT NULL);
17917
7319
CREATE INDEX archive__status__idx ON archive USING btree (status);
17920
CREATE INDEX archive_fti ON archive USING gist (fti);
7321
CREATE INDEX archive_fti ON archive USING gist (fti ts2.gist_tsvector_ops);
17923
7323
CREATE INDEX archiveauthtoken__archive__idx ON archiveauthtoken USING btree (archive);
17926
7325
CREATE INDEX archiveauthtoken__date_created__idx ON archiveauthtoken USING btree (date_created);
17929
7327
CREATE INDEX archiveauthtoken__person__idx ON archiveauthtoken USING btree (person);
17932
7329
CREATE INDEX archivedependency__archive__idx ON archivedependency USING btree (archive);
17935
7331
CREATE INDEX archivedependency__component__idx ON archivedependency USING btree (component);
17938
7333
CREATE INDEX archivedependency__dependency__idx ON archivedependency USING btree (dependency);
17941
7335
CREATE INDEX archivejob__archive__job_type__idx ON archivejob USING btree (archive, job_type);
17944
7337
CREATE INDEX archivepermission__archive__component__permission__idx ON archivepermission USING btree (archive, component, permission);
17947
7339
CREATE INDEX archivepermission__archive__sourcepackagename__permission__idx ON archivepermission USING btree (archive, sourcepackagename, permission);
17950
7341
CREATE INDEX archivepermission__packageset__idx ON archivepermission USING btree (packageset) WHERE (packageset IS NOT NULL);
17953
7343
CREATE INDEX archivepermission__person__archive__idx ON archivepermission USING btree (person, archive);
17956
7345
CREATE INDEX archivesubscriber__archive__idx ON archivesubscriber USING btree (archive);
17959
7347
CREATE INDEX archivesubscriber__cancelled_by__idx ON archivesubscriber USING btree (cancelled_by) WHERE (cancelled_by IS NOT NULL);
17962
7349
CREATE INDEX archivesubscriber__date_created__idx ON archivesubscriber USING btree (date_created);
17965
7351
CREATE INDEX archivesubscriber__date_expires__idx ON archivesubscriber USING btree (date_expires) WHERE (date_expires IS NOT NULL);
17968
7353
CREATE INDEX archivesubscriber__registrant__idx ON archivesubscriber USING btree (registrant);
17971
7355
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);
17974
7363
CREATE INDEX binarypackagebuild__distro_arch_series__idx ON binarypackagebuild USING btree (distro_arch_series);
17977
7365
CREATE UNIQUE INDEX binarypackagebuild__package_build__idx ON binarypackagebuild USING btree (package_build);
17980
7367
CREATE INDEX binarypackagebuild__source_package_release_idx ON binarypackagebuild USING btree (source_package_release);
17983
7369
CREATE INDEX binarypackagefile_binarypackage_idx ON binarypackagefile USING btree (binarypackagerelease);
17986
7371
CREATE INDEX binarypackagefile_libraryfile_idx ON binarypackagefile USING btree (libraryfile);
17989
CREATE INDEX binarypackagepublishinghistory__binarypackagename__idx ON binarypackagepublishinghistory USING btree (binarypackagename);
17992
7373
CREATE UNIQUE INDEX binarypackagerelease__debug_package__key ON binarypackagerelease USING btree (debug_package);
17995
CREATE INDEX binarypackagerelease__version__idx ON binarypackagerelease USING btree (version);
17998
7375
CREATE INDEX binarypackagerelease_build_idx ON binarypackagerelease USING btree (build);
18001
CREATE INDEX binarypackagerelease_fti ON binarypackagerelease USING gist (fti);
18004
CREATE INDEX branch__access_policy__idx ON branch USING btree (access_policy);
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);
18007
7393
CREATE INDEX branch__date_created__idx ON branch USING btree (date_created);
18010
7395
CREATE UNIQUE INDEX branch__ds__spn__owner__name__key ON branch USING btree (distroseries, sourcepackagename, owner, name) WHERE (distroseries IS NOT NULL);
18013
7397
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);
18019
7399
CREATE INDEX branch__next_mirror_time__idx ON branch USING btree (next_mirror_time) WHERE (next_mirror_time IS NOT NULL);
18022
7401
CREATE UNIQUE INDEX branch__owner__name__key ON branch USING btree (owner, name) WHERE ((product IS NULL) AND (distroseries IS NULL));
18025
7403
CREATE INDEX branch__owner_name__idx ON branch USING btree (owner_name);
18028
7405
CREATE INDEX branch__private__idx ON branch USING btree (private);
18031
7407
CREATE INDEX branch__product__id__idx ON branch USING btree (product, id);
18033
7409
ALTER TABLE branch CLUSTER ON branch__product__id__idx;
18036
7411
CREATE UNIQUE INDEX branch__product__owner__name__key ON branch USING btree (product, owner, name) WHERE (product IS NOT NULL);
18039
7413
CREATE INDEX branch__registrant__idx ON branch USING btree (registrant);
18042
7415
CREATE INDEX branch__reviewer__idx ON branch USING btree (reviewer);
18045
7417
CREATE INDEX branch__stacked_on__idx ON branch USING btree (stacked_on) WHERE (stacked_on IS NOT NULL);
18048
7419
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);
18054
7421
CREATE INDEX branch_author_idx ON branch USING btree (author);
18057
7423
CREATE INDEX branch_owner_idx ON branch USING btree (owner);
18060
7425
CREATE INDEX branchjob__branch__idx ON branchjob USING btree (branch);
18063
7427
CREATE INDEX branchmergeproposal__dependent_branch__idx ON branchmergeproposal USING btree (dependent_branch);
18066
7429
CREATE INDEX branchmergeproposal__merge_diff__idx ON branchmergeproposal USING btree (merge_diff);
18069
7431
CREATE INDEX branchmergeproposal__merge_log_file__idx ON branchmergeproposal USING btree (merge_log_file);
18072
7433
CREATE INDEX branchmergeproposal__merge_reporter__idx ON branchmergeproposal USING btree (merge_reporter) WHERE (merge_reporter IS NOT NULL);
18075
7435
CREATE INDEX branchmergeproposal__merger__idx ON branchmergeproposal USING btree (merger);
18078
7437
CREATE INDEX branchmergeproposal__queuer__idx ON branchmergeproposal USING btree (queuer);
18081
7439
CREATE INDEX branchmergeproposal__registrant__idx ON branchmergeproposal USING btree (registrant);
7441
CREATE INDEX branchmergeproposal__review_diff__idx ON branchmergeproposal USING btree (review_diff);
18084
7443
CREATE INDEX branchmergeproposal__reviewer__idx ON branchmergeproposal USING btree (reviewer);
18087
7445
CREATE INDEX branchmergeproposal__source_branch__idx ON branchmergeproposal USING btree (source_branch);
18090
7447
CREATE INDEX branchmergeproposal__superseded_by__idx ON branchmergeproposal USING btree (superseded_by) WHERE (superseded_by IS NOT NULL);
18093
7449
CREATE INDEX branchmergeproposal__target_branch__idx ON branchmergeproposal USING btree (target_branch);
18096
7451
CREATE INDEX branchmergeproposaljob__branch_merge_proposal__idx ON branchmergeproposaljob USING btree (branch_merge_proposal);
18099
CREATE INDEX branchmergequeue__registrant__idx ON branchmergequeue USING btree (registrant);
7453
CREATE INDEX branchmergerobot__owner__idx ON branchmergerobot USING btree (owner);
7455
CREATE INDEX branchmergerobot__registrant__idx ON branchmergerobot USING btree (registrant);
18102
7457
CREATE INDEX branchsubscription__branch__idx ON branchsubscription USING btree (branch);
18105
7459
CREATE INDEX branchsubscription__subscribed_by__idx ON branchsubscription USING btree (subscribed_by);
18108
7461
CREATE INDEX branchvisibilitypolicy__product__idx ON branchvisibilitypolicy USING btree (product) WHERE (product IS NOT NULL);
18111
7463
CREATE INDEX branchvisibilitypolicy__project__idx ON branchvisibilitypolicy USING btree (project) WHERE (project IS NOT NULL);
18114
7465
CREATE INDEX branchvisibilitypolicy__team__idx ON branchvisibilitypolicy USING btree (team) WHERE (team IS NOT NULL);
18117
7467
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);
18123
7469
CREATE INDEX bug__date_last_message__idx ON bug USING btree (date_last_message);
18126
7471
CREATE INDEX bug__date_last_updated__idx ON bug USING btree (date_last_updated);
18128
7473
ALTER TABLE bug CLUSTER ON bug__date_last_updated__idx;
18131
7475
CREATE INDEX bug__datecreated__idx ON bug USING btree (datecreated);
18134
7477
CREATE INDEX bug__heat__idx ON bug USING btree (heat);
18137
7479
CREATE INDEX bug__heat_last_updated__idx ON bug USING btree (heat_last_updated);
18140
7481
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));
18149
7483
CREATE INDEX bug__users_affected_count__idx ON bug USING btree (users_affected_count);
18152
7485
CREATE INDEX bug__users_unaffected_count__idx ON bug USING btree (users_unaffected_count);
18155
7487
CREATE INDEX bug__who_made_private__idx ON bug USING btree (who_made_private) WHERE (who_made_private IS NOT NULL);
18158
7489
CREATE INDEX bug_duplicateof_idx ON bug USING btree (duplicateof);
18161
7491
CREATE INDEX bug_fti ON bug USING gist (fti);
18164
7493
CREATE INDEX bug_owner_idx ON bug USING btree (owner);
18167
7495
CREATE INDEX bugactivity_bug_datechanged_idx ON bugactivity USING btree (bug, datechanged);
18170
7497
CREATE INDEX bugactivity_datechanged_idx ON bugactivity USING btree (datechanged);
18173
7499
CREATE INDEX bugactivity_person_datechanged_idx ON bugactivity USING btree (person, datechanged);
18176
7501
CREATE INDEX bugaffectsperson__person__idx ON bugaffectsperson USING btree (person);
18179
7503
CREATE INDEX bugattachment__bug__idx ON bugattachment USING btree (bug);
18182
7505
CREATE INDEX bugattachment_libraryfile_idx ON bugattachment USING btree (libraryfile);
18185
7507
CREATE INDEX bugattachment_message_idx ON bugattachment USING btree (message);
18188
7509
CREATE INDEX bugbranch__registrant__idx ON bugbranch USING btree (registrant);
18191
7511
CREATE INDEX bugcve_cve_index ON bugcve USING btree (cve);
18194
7513
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);
18200
7515
CREATE INDEX bugmessage_message_idx ON bugmessage USING btree (message);
18203
CREATE INDEX bugmute__bug__idx ON bugmute USING btree (bug);
18206
7517
CREATE INDEX bugnomination__bug__idx ON bugnomination USING btree (bug);
18209
7519
CREATE INDEX bugnomination__decider__idx ON bugnomination USING btree (decider) WHERE (decider IS NOT NULL);
18212
7521
CREATE UNIQUE INDEX bugnomination__distroseries__bug__key ON bugnomination USING btree (distroseries, bug) WHERE (distroseries IS NOT NULL);
18215
7523
CREATE INDEX bugnomination__owner__idx ON bugnomination USING btree (owner);
18218
7525
CREATE UNIQUE INDEX bugnomination__productseries__bug__key ON bugnomination USING btree (productseries, bug) WHERE (productseries IS NOT NULL);
18221
7527
CREATE INDEX bugnotification__date_emailed__idx ON bugnotification USING btree (date_emailed);
18223
ALTER TABLE bugnotification CLUSTER ON bugnotification__date_emailed__idx;
18226
7529
CREATE INDEX bugnotificationattachment__bug_notification__idx ON bugnotificationattachment USING btree (bug_notification);
18229
7531
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);
18235
7533
CREATE INDEX bugnotificationrecipient__person__idx ON bugnotificationrecipient USING btree (person);
18238
7535
CREATE INDEX bugnotificationrecipientarchive__bug_notification__idx ON bugnotificationrecipientarchive USING btree (bug_notification);
18241
7537
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);
18244
7551
CREATE INDEX bugsubscription__subscribed_by__idx ON bugsubscription USING btree (subscribed_by);
18247
7553
CREATE INDEX bugsubscription_bug_idx ON bugsubscription USING btree (bug);
18249
7555
ALTER TABLE bugsubscription CLUSTER ON bugsubscription_bug_idx;
18252
7557
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);
18330
7559
CREATE INDEX bugtag__bug__idx ON bugtag USING btree (bug);
18333
7561
CREATE INDEX bugtask__assignee__idx ON bugtask USING btree (assignee);
18336
7563
CREATE INDEX bugtask__binarypackagename__idx ON bugtask USING btree (binarypackagename) WHERE (binarypackagename IS NOT NULL);
18339
7565
CREATE INDEX bugtask__bug__idx ON bugtask USING btree (bug);
18342
7567
CREATE INDEX bugtask__bugwatch__idx ON bugtask USING btree (bugwatch) WHERE (bugwatch IS NOT NULL);
18345
CREATE INDEX bugtask__date_closed__id__idx2 ON bugtask USING btree (date_closed, id DESC);
7569
CREATE UNIQUE INDEX bugtask__date_closed__id__idx ON bugtask USING btree (date_closed, id) WHERE (status = 30);
18348
7571
CREATE INDEX bugtask__date_incomplete__idx ON bugtask USING btree (date_incomplete) WHERE (date_incomplete IS NOT NULL);
18351
7573
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);
18357
7575
CREATE INDEX bugtask__distribution__sourcepackagename__idx ON bugtask USING btree (distribution, sourcepackagename);
18359
7577
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);
18365
7579
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);
18371
7581
CREATE INDEX bugtask__milestone__idx ON bugtask USING btree (milestone);
18374
7583
CREATE INDEX bugtask__owner__idx ON bugtask USING btree (owner);
18377
7585
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);
18383
7587
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);
18389
7589
CREATE INDEX bugtask__sourcepackagename__idx ON bugtask USING btree (sourcepackagename) WHERE (sourcepackagename IS NOT NULL);
18392
7591
CREATE INDEX bugtask__status__idx ON bugtask USING btree (status);
18395
7593
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));
18398
CREATE INDEX bugtask_fti ON bugtask USING gist (fti);
18401
CREATE INDEX bugtask_importance_idx ON bugtask USING btree (importance, id DESC);
7595
CREATE INDEX bugtask_fti ON bugtask USING gist (fti ts2.gist_tsvector_ops);
18404
7597
CREATE UNIQUE INDEX bugtracker_name_key ON bugtracker USING btree (name);
18407
7599
CREATE INDEX bugtracker_owner_idx ON bugtracker USING btree (owner);
18410
7601
CREATE INDEX bugtrackeralias__bugtracker__idx ON bugtrackeralias USING btree (bugtracker);
18413
7603
CREATE INDEX bugtrackerperson__person__idx ON bugtrackerperson USING btree (person);
18416
7605
CREATE INDEX bugwatch__lastchecked__idx ON bugwatch USING btree (lastchecked);
18419
7607
CREATE INDEX bugwatch__next_check__idx ON bugwatch USING btree (next_check);
18422
7609
CREATE INDEX bugwatch__remote_lp_bug_id__idx ON bugwatch USING btree (remote_lp_bug_id) WHERE (remote_lp_bug_id IS NOT NULL);
18425
7611
CREATE INDEX bugwatch__remotebug__idx ON bugwatch USING btree (remotebug);
18428
7613
CREATE INDEX bugwatch_bug_idx ON bugwatch USING btree (bug);
18431
7615
CREATE INDEX bugwatch_bugtracker_idx ON bugwatch USING btree (bugtracker);
18434
7617
CREATE INDEX bugwatch_datecreated_idx ON bugwatch USING btree (datecreated);
18437
7619
CREATE INDEX bugwatch_owner_idx ON bugwatch USING btree (owner);
18440
7621
CREATE INDEX bugwatchactivity__bug_watch__idx ON bugwatchactivity USING btree (bug_watch);
18442
7623
ALTER TABLE bugwatchactivity CLUSTER ON bugwatchactivity__bug_watch__idx;
7625
CREATE INDEX bugwatchactivity__date__idx ON bugwatchactivity USING btree (activity_date);
18445
7627
CREATE INDEX builder__owner__idx ON builder USING btree (owner);
18448
7629
CREATE INDEX buildfarmjob__builder_and_status__idx ON buildfarmjob USING btree (builder, status);
18451
7631
CREATE INDEX buildfarmjob__date_created__idx ON buildfarmjob USING btree (date_created);
18454
7633
CREATE INDEX buildfarmjob__date_finished__idx ON buildfarmjob USING btree (date_finished);
18457
7635
CREATE INDEX buildfarmjob__date_started__idx ON buildfarmjob USING btree (date_started);
18460
7637
CREATE INDEX buildfarmjob__log__idx ON buildfarmjob USING btree (log) WHERE (log IS NOT NULL);
18463
7639
CREATE INDEX buildfarmjob__status__idx ON buildfarmjob USING btree (status);
18466
7641
CREATE UNIQUE INDEX buildqueue__builder__id__idx ON buildqueue USING btree (builder, id);
18468
7643
ALTER TABLE buildqueue CLUSTER ON buildqueue__builder__id__idx;
18471
7645
CREATE UNIQUE INDEX buildqueue__builder__unq ON buildqueue USING btree (builder) WHERE (builder IS NOT NULL);
18474
7647
CREATE INDEX buildqueue__job_type__idx ON buildqueue USING btree (job_type);
18477
7649
CREATE INDEX buildqueue__processor__virtualized__idx ON buildqueue USING btree (processor, virtualized) WHERE (processor IS NOT NULL);
18480
7651
CREATE INDEX changeset_datecreated_idx ON revision USING btree (date_created);
18483
7653
CREATE INDEX codeimport__assignee__idx ON codeimport USING btree (assignee);
18486
7655
CREATE UNIQUE INDEX codeimport__cvs_root__cvs_module__key ON codeimport USING btree (cvs_root, cvs_module) WHERE (cvs_root IS NOT NULL);
18489
7657
CREATE INDEX codeimport__owner__idx ON codeimport USING btree (owner);
18492
7659
CREATE INDEX codeimport__registrant__idx ON codeimport USING btree (registrant);
18495
7661
CREATE UNIQUE INDEX codeimport__url__idx ON codeimport USING btree (url) WHERE (url IS NOT NULL);
18498
7663
CREATE INDEX codeimportevent__code_import__date_created__id__idx ON codeimportevent USING btree (code_import, date_created, id);
18501
7665
CREATE INDEX codeimportevent__date_created__id__idx ON codeimportevent USING btree (date_created, id);
18504
7667
CREATE INDEX codeimportevent__message__date_created__idx ON codeimportevent USING btree (machine, date_created) WHERE (machine IS NOT NULL);
18507
7669
CREATE INDEX codeimportevent__person__idx ON codeimportevent USING btree (person) WHERE (person IS NOT NULL);
18510
7671
CREATE INDEX codeimportjob__code_import__date_created__idx ON codeimportjob USING btree (code_import, date_created);
18513
7673
CREATE INDEX codeimportjob__machine__date_created__idx ON codeimportjob USING btree (machine, date_created);
18516
7675
CREATE INDEX codeimportjob__requesting_user__idx ON codeimportjob USING btree (requesting_user);
18519
7677
CREATE INDEX codeimportresult__code_import__date_created__idx ON codeimportresult USING btree (code_import, date_created);
18522
7679
CREATE INDEX codeimportresult__log_file__idx ON codeimportresult USING btree (log_file);
18525
7681
CREATE INDEX codeimportresult__machine__date_created__idx ON codeimportresult USING btree (machine, date_created);
18528
7683
CREATE INDEX codeimportresult__requesting_user__idx ON codeimportresult USING btree (requesting_user);
18531
7685
CREATE INDEX codereviewvote__branch_merge_proposal__idx ON codereviewvote USING btree (branch_merge_proposal);
18534
7687
CREATE INDEX codereviewvote__registrant__idx ON codereviewvote USING btree (registrant);
18537
7689
CREATE INDEX codereviewvote__reviewer__idx ON codereviewvote USING btree (reviewer);
18540
7691
CREATE INDEX codereviewvote__vote_message__idx ON codereviewvote USING btree (vote_message);
18543
7693
CREATE INDEX commercialsubscription__product__idx ON commercialsubscription USING btree (product);
18546
7695
CREATE INDEX commercialsubscription__purchaser__idx ON commercialsubscription USING btree (purchaser);
18549
7697
CREATE INDEX commercialsubscription__registrant__idx ON commercialsubscription USING btree (registrant);
18552
7699
CREATE INDEX commercialsubscription__sales_system_id__idx ON commercialsubscription USING btree (sales_system_id);
18555
7701
CREATE UNIQUE INDEX customlanguagecode__distribution__sourcepackagename__code__key ON customlanguagecode USING btree (distribution, sourcepackagename, language_code) WHERE (distribution IS NOT NULL);
18558
7703
CREATE UNIQUE INDEX customlanguagecode__product__code__key ON customlanguagecode USING btree (product, language_code) WHERE (product IS NOT NULL);
18561
7705
CREATE INDEX cve_datecreated_idx ON cve USING btree (datecreated);
18564
7707
CREATE INDEX cve_datemodified_idx ON cve USING btree (datemodified);
18567
CREATE INDEX cve_fti ON cve USING gist (fti);
7709
CREATE INDEX cve_fti ON cve USING gist (fti ts2.gist_tsvector_ops);
18570
7711
CREATE INDEX cvereference_cve_idx ON cvereference USING btree (cve);
18573
7713
CREATE INDEX diff__diff_text__idx ON diff USING btree (diff_text);
18576
7715
CREATE INDEX distribution__bug_supervisor__idx ON distribution USING btree (bug_supervisor) WHERE (bug_supervisor IS NOT NULL);
18579
7717
CREATE INDEX distribution__driver__idx ON distribution USING btree (driver);
18582
7719
CREATE INDEX distribution__icon__idx ON distribution USING btree (icon) WHERE (icon IS NOT NULL);
18585
7721
CREATE INDEX distribution__language_pack_admin__idx ON distribution USING btree (language_pack_admin);
18588
7723
CREATE INDEX distribution__logo__idx ON distribution USING btree (logo) WHERE (logo IS NOT NULL);
18591
7725
CREATE INDEX distribution__members__idx ON distribution USING btree (members);
18594
7727
CREATE INDEX distribution__mirror_admin__idx ON distribution USING btree (mirror_admin);
18597
7729
CREATE INDEX distribution__mugshot__idx ON distribution USING btree (mugshot) WHERE (mugshot IS NOT NULL);
18600
7731
CREATE INDEX distribution__owner__idx ON distribution USING btree (owner);
18603
CREATE INDEX distribution__registrant__idx ON distribution USING btree (registrant);
18606
7733
CREATE INDEX distribution__security_contact__idx ON distribution USING btree (security_contact);
18609
7735
CREATE INDEX distribution__upload_admin__idx ON distribution USING btree (upload_admin);
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);
7737
CREATE INDEX distribution_fti ON distribution USING gist (fti ts2.gist_tsvector_ops);
18618
7739
CREATE INDEX distribution_translationgroup_idx ON distribution USING btree (translationgroup);
7741
CREATE INDEX distributionbounty_distribution_idx ON distributionbounty USING btree (distribution);
18621
7743
CREATE UNIQUE INDEX distributionmirror__archive__distribution__country__key ON distributionmirror USING btree (distribution, country, content) WHERE ((country_dns_mirror IS TRUE) AND (content = 1));
18624
7745
CREATE INDEX distributionmirror__country__status__idx ON distributionmirror USING btree (country, status);
18627
7747
CREATE INDEX distributionmirror__owner__idx ON distributionmirror USING btree (owner);
18630
7749
CREATE UNIQUE INDEX distributionmirror__releases__distribution__country__key ON distributionmirror USING btree (distribution, country, content) WHERE ((country_dns_mirror IS TRUE) AND (content = 2));
18633
7751
CREATE INDEX distributionmirror__reviewer__idx ON distributionmirror USING btree (reviewer);
18636
7753
CREATE INDEX distributionmirror__status__idx ON distributionmirror USING btree (status);
18639
7755
CREATE INDEX distributionsourcepackagecache__archive__idx ON distributionsourcepackagecache USING btree (archive);
18642
CREATE INDEX distributionsourcepackagecache_fti ON distributionsourcepackagecache USING gist (fti);
7757
CREATE INDEX distributionsourcepackagecache_fti ON distributionsourcepackagecache USING gist (fti ts2.gist_tsvector_ops);
18645
7759
CREATE INDEX distroarchseries__distroseries__idx ON distroarchseries USING btree (distroseries);
18648
7761
CREATE INDEX distroarchseries__owner__idx ON distroarchseries USING btree (owner);
7763
CREATE INDEX distrocomponentuploader_uploader_idx ON distrocomponentuploader USING btree (uploader);
18651
7765
CREATE INDEX distroseries__driver__idx ON distroseries USING btree (driver) WHERE (driver IS NOT NULL);
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);
7767
CREATE INDEX distroseries__owner__idx ON distroseries USING btree (owner);
18687
7769
CREATE INDEX distroseriespackagecache__archive__idx ON distroseriespackagecache USING btree (archive);
18690
7771
CREATE INDEX distroseriespackagecache__distroseries__idx ON distroseriespackagecache USING btree (distroseries);
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);
7773
CREATE INDEX distroseriespackagecache_fti ON distroseriespackagecache USING gist (fti ts2.gist_tsvector_ops);
18702
7775
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';
18708
7777
CREATE INDEX emailaddress__account__status__idx ON emailaddress USING btree (account, status);
18711
7779
CREATE UNIQUE INDEX emailaddress__lower_email__key ON emailaddress USING btree (lower(email));
18714
7781
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';
18720
7783
CREATE INDEX emailaddress__person__status__idx ON emailaddress USING btree (person, status);
18723
7785
CREATE INDEX entitlement__approved_by__idx ON entitlement USING btree (approved_by) WHERE (approved_by IS NOT NULL);
18726
7787
CREATE INDEX entitlement__distribution__idx ON entitlement USING btree (distribution) WHERE (distribution IS NOT NULL);
18729
7789
CREATE INDEX entitlement__person__idx ON entitlement USING btree (person);
18732
7791
CREATE INDEX entitlement__product__idx ON entitlement USING btree (product) WHERE (product IS NOT NULL);
18735
7793
CREATE INDEX entitlement__project__idx ON entitlement USING btree (project) WHERE (project IS NOT NULL);
18738
7795
CREATE INDEX entitlement__registrant__idx ON entitlement USING btree (registrant) WHERE (registrant IS NOT NULL);
18741
7797
CREATE INDEX entitlement_lookup_idx ON entitlement USING btree (entitlement_type, date_starts, date_expires, person, state);
18744
7799
CREATE INDEX faq__distribution__idx ON faq USING btree (distribution) WHERE (distribution IS NOT NULL);
18747
7801
CREATE INDEX faq__last_updated_by__idx ON faq USING btree (last_updated_by);
18750
7803
CREATE INDEX faq__owner__idx ON faq USING btree (owner);
18753
7805
CREATE INDEX faq__product__idx ON faq USING btree (product) WHERE (product IS NOT NULL);
18756
CREATE INDEX faq_fti ON faq USING gist (fti);
7807
CREATE INDEX faq_fti ON faq USING gist (fti ts2.gist_tsvector_ops);
18759
7809
CREATE INDEX featuredproject__pillar_name__idx ON featuredproject USING btree (pillar_name);
18762
CREATE INDEX featureflagchangelogentry__person__idx ON featureflagchangelogentry USING btree (person);
18765
7811
CREATE INDEX flatpackagesetinclusion__child__idx ON flatpackagesetinclusion USING btree (child);
18768
7813
CREATE INDEX hwdevice__bus_product_id__idx ON hwdevice USING btree (bus_product_id);
18771
7815
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);
18774
7817
CREATE INDEX hwdevice__name__idx ON hwdevice USING btree (name);
18777
7819
CREATE UNIQUE INDEX hwdeviceclass__device__main_class__key ON hwdeviceclass USING btree (device, main_class) WHERE (sub_class IS NULL);
18780
7821
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);
18783
7823
CREATE INDEX hwdeviceclass__main_class__idx ON hwdeviceclass USING btree (main_class);
18786
7825
CREATE INDEX hwdeviceclass__sub_class__idx ON hwdeviceclass USING btree (sub_class);
18789
7827
CREATE UNIQUE INDEX hwdevicedriverlink__device__driver__key ON hwdevicedriverlink USING btree (device, driver) WHERE (driver IS NOT NULL);
18792
7829
CREATE INDEX hwdevicedriverlink__device__idx ON hwdevicedriverlink USING btree (device);
18795
7831
CREATE UNIQUE INDEX hwdevicedriverlink__device__key ON hwdevicedriverlink USING btree (device) WHERE (driver IS NULL);
18798
7833
CREATE INDEX hwdevicedriverlink__driver__idx ON hwdevicedriverlink USING btree (driver);
18801
7835
CREATE INDEX hwdevicenamevariant__device__idx ON hwdevicenamevariant USING btree (device);
18804
7837
CREATE INDEX hwdevicenamevariant__product_name__idx ON hwdevicenamevariant USING btree (product_name);
18807
7839
CREATE INDEX hwdmihandle__submission__idx ON hwdmihandle USING btree (submission);
18810
7841
CREATE INDEX hwdmivalue__hanlde__idx ON hwdmivalue USING btree (handle);
18813
7843
CREATE INDEX hwdriver__name__idx ON hwdriver USING btree (name);
18816
7845
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);
18825
7847
CREATE INDEX hwsubmission__lower_raw_emailaddress__idx ON hwsubmission USING btree (lower(raw_emailaddress));
18828
7849
CREATE INDEX hwsubmission__owner__idx ON hwsubmission USING btree (owner);
18831
7851
CREATE INDEX hwsubmission__raw_emailaddress__idx ON hwsubmission USING btree (raw_emailaddress);
18834
7853
CREATE INDEX hwsubmission__raw_submission__idx ON hwsubmission USING btree (raw_submission);
18837
7855
CREATE INDEX hwsubmission__status__idx ON hwsubmission USING btree (status);
18840
7857
CREATE INDEX hwsubmission__system_fingerprint__idx ON hwsubmission USING btree (system_fingerprint);
18843
7859
CREATE INDEX hwsubmissionbug__bug ON hwsubmissionbug USING btree (bug);
18846
7861
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);
18852
7863
CREATE INDEX hwsubmissiondevice__submission__idx ON hwsubmissiondevice USING btree (submission);
18855
7865
CREATE UNIQUE INDEX hwtest__name__version__key ON hwtest USING btree (name, version) WHERE (namespace IS NULL);
18858
7867
CREATE UNIQUE INDEX hwtest__namespace__name__version__key ON hwtest USING btree (namespace, name, version) WHERE (namespace IS NOT NULL);
18861
7869
CREATE INDEX hwtestanswer__choice__idx ON hwtestanswer USING btree (choice);
18864
7871
CREATE INDEX hwtestanswer__submission__idx ON hwtestanswer USING btree (submission);
18867
7873
CREATE INDEX hwtestanswer__test__idx ON hwtestanswer USING btree (test);
18870
7875
CREATE INDEX hwtestanswerchoice__test__idx ON hwtestanswerchoice USING btree (test);
18873
7877
CREATE INDEX hwtestanswercount__choice__idx ON hwtestanswercount USING btree (choice);
18876
7879
CREATE INDEX hwtestanswercount__distroarchrelease__idx ON hwtestanswercount USING btree (distroarchseries) WHERE (distroarchseries IS NOT NULL);
18879
7881
CREATE INDEX hwtestanswercount__test__idx ON hwtestanswercount USING btree (test);
18882
7883
CREATE INDEX hwtestanswercountdevice__device_driver__idx ON hwtestanswercountdevice USING btree (device_driver);
18885
7885
CREATE INDEX hwtestanswerdevice__device_driver__idx ON hwtestanswerdevice USING btree (device_driver);
18888
7887
CREATE INDEX hwvendorid__vendor_id_for_bus__idx ON hwvendorid USING btree (vendor_id_for_bus);
18891
7889
CREATE INDEX hwvendorid__vendorname__idx ON hwvendorid USING btree (vendor_name);
18894
7891
CREATE UNIQUE INDEX hwvendorname__lc_vendor_name__idx ON hwvendorname USING btree (ulower(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);
7893
CREATE INDEX hwvendorname__name__idx ON hwdriver USING btree (name);
18909
7895
CREATE INDEX ircid_person_idx ON ircid USING btree (person);
18912
7897
CREATE INDEX jabberid_person_idx ON jabberid USING btree (person);
18915
7899
CREATE INDEX job__date_finished__idx ON job USING btree (date_finished) WHERE (date_finished IS NOT NULL);
18918
7901
CREATE INDEX job__lease_expires__idx ON job USING btree (lease_expires);
18921
7903
CREATE INDEX job__requester__key ON job USING btree (requester) WHERE (requester IS NOT NULL);
18924
7905
CREATE INDEX job__scheduled_start__idx ON job USING btree (scheduled_start);
18927
7907
CREATE INDEX karma_person_datecreated_idx ON karma USING btree (person, datecreated);
18929
7909
ALTER TABLE karma CLUSTER ON karma_person_datecreated_idx;
18932
7911
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));
18935
7913
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));
18938
7915
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));
18941
7917
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));
18944
7919
CREATE INDEX karmacache__person__category__idx ON karmacache USING btree (person, category);
18947
7921
CREATE INDEX karmacache__product__category__karmavalue__idx ON karmacache USING btree (product, category, karmavalue) WHERE ((category IS NOT NULL) AND (product IS NOT NULL));
18950
7923
CREATE INDEX karmacache__product__karmavalue__idx ON karmacache USING btree (product, karmavalue) WHERE ((category IS NULL) AND (product IS NOT NULL));
18953
7925
CREATE INDEX karmacache__project__category__karmavalue__idx ON karmacache USING btree (project, category, karmavalue) WHERE (project IS NOT NULL);
18956
7927
CREATE INDEX karmacache__project__karmavalue__idx ON karmacache USING btree (project, karmavalue) WHERE ((category IS NULL) AND (project IS NOT NULL));
18959
7929
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));
18962
7931
CREATE INDEX karmacache__sourcepackagename__distribution__karmavalue__idx ON karmacache USING btree (sourcepackagename, distribution, karmavalue) WHERE (sourcepackagename IS NOT NULL);
18965
7933
CREATE INDEX karmacache__sourcepackagename__karmavalue__idx ON karmacache USING btree (sourcepackagename, distribution, karmavalue) WHERE ((category IS NULL) AND (sourcepackagename IS NOT NULL));
18968
7935
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))));
18971
7937
CREATE INDEX karmacache_person_idx ON karmacache USING btree (person);
18974
7939
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));
18977
7941
CREATE UNIQUE INDEX karmatotalcache_karma_total_person_idx ON karmatotalcache USING btree (karma_total, person);
18980
7943
CREATE INDEX languagepack__file__idx ON languagepack USING btree (file);
18983
7945
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);
18989
7947
CREATE INDEX libraryfilealias__filename__idx ON libraryfilealias USING btree (filename);
18992
7949
CREATE INDEX libraryfilealias_content_idx ON libraryfilealias USING btree (content);
18995
7951
CREATE INDEX libraryfilecontent__md5__idx ON libraryfilecontent USING btree (md5);
18998
7953
CREATE INDEX libraryfilecontent__sha256__idx ON libraryfilecontent USING btree (sha256);
19001
7955
CREATE INDEX libraryfilecontent_sha1_filesize_idx ON libraryfilecontent USING btree (sha1, filesize);
19004
7957
CREATE INDEX logintoken_requester_idx ON logintoken USING btree (requester);
19007
CREATE INDEX lp_openididentifier__account__idx ON lp_openididentifier USING btree (account);
19010
7959
CREATE INDEX lp_teamparticipation__person__idx ON lp_teamparticipation USING btree (person);
19013
7961
CREATE INDEX mailinglist__date_registered__idx ON mailinglist USING btree (status, date_registered);
19016
7963
CREATE INDEX mailinglist__registrant__idx ON mailinglist USING btree (registrant);
19019
7965
CREATE INDEX mailinglist__reviewer__idx ON mailinglist USING btree (reviewer);
19022
7967
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);
19025
7973
CREATE INDEX mailinglistsubscription__email_address__idx ON mailinglistsubscription USING btree (email_address) WHERE (email_address IS NOT NULL);
19028
7975
CREATE INDEX mailinglistsubscription__mailing_list__idx ON mailinglistsubscription USING btree (mailing_list);
19031
7977
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);
19034
7983
CREATE INDEX mergedirectivejob__merge_directive__idx ON mergedirectivejob USING btree (merge_directive);
19037
CREATE INDEX message__datecreated__idx ON message USING btree (datecreated);
19040
CREATE INDEX message_fti ON message USING gist (fti);
7985
CREATE INDEX message_fti ON message USING gist (fti ts2.gist_tsvector_ops);
19043
7987
CREATE INDEX message_owner_idx ON message USING btree (owner);
19046
7989
CREATE INDEX message_parent_idx ON message USING btree (parent);
19049
7991
CREATE INDEX message_raw_idx ON message USING btree (raw) WHERE (raw IS NOT NULL);
19052
7993
CREATE INDEX message_rfc822msgid_idx ON message USING btree (rfc822msgid);
19055
7995
CREATE INDEX messageapproval__disposed_by__idx ON messageapproval USING btree (disposed_by) WHERE (disposed_by IS NOT NULL);
19058
7997
CREATE INDEX messageapproval__mailing_list__status__posted_date__idx ON messageapproval USING btree (mailing_list, status, posted_date);
19061
7999
CREATE INDEX messageapproval__message__idx ON messageapproval USING btree (message);
19064
8001
CREATE INDEX messageapproval__posted_by__idx ON messageapproval USING btree (posted_by);
19067
8003
CREATE INDEX messageapproval__posted_message__idx ON messageapproval USING btree (posted_message);
19070
8005
CREATE INDEX messagechunk_blob_idx ON messagechunk USING btree (blob) WHERE (blob IS NOT NULL);
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));
8007
CREATE INDEX messagechunk_fti ON messagechunk USING gist (fti ts2.gist_tsvector_ops);
19079
8009
CREATE INDEX mirror__owner__idx ON mirror USING btree (owner);
19082
8011
CREATE UNIQUE INDEX mirrordistroarchseries_uniq ON mirrordistroarchseries USING btree (distribution_mirror, distroarchseries, component, pocket);
19085
8013
CREATE UNIQUE INDEX mirrordistroseriessource_uniq ON mirrordistroseriessource USING btree (distribution_mirror, distroseries, component, pocket);
19088
8015
CREATE INDEX mirrorproberecord__date_created__idx ON mirrorproberecord USING btree (date_created);
19091
8017
CREATE INDEX mirrorproberecord__distribution_mirror__date_created__idx ON mirrorproberecord USING btree (distribution_mirror, date_created);
19094
8019
CREATE INDEX mirrorproberecord__log_file__idx ON mirrorproberecord USING btree (log_file) WHERE (log_file IS NOT NULL);
19097
8021
CREATE INDEX oauthaccesstoken__consumer__idx ON oauthaccesstoken USING btree (consumer);
19100
8023
CREATE INDEX oauthaccesstoken__date_expires__idx ON oauthaccesstoken USING btree (date_expires) WHERE (date_expires IS NOT NULL);
19103
8025
CREATE INDEX oauthaccesstoken__distribution__sourcepackagename__idx ON oauthaccesstoken USING btree (distribution, sourcepackagename) WHERE (distribution IS NOT NULL);
19106
8027
CREATE INDEX oauthaccesstoken__person__idx ON oauthaccesstoken USING btree (person);
19109
8029
CREATE INDEX oauthaccesstoken__product__idx ON oauthaccesstoken USING btree (product) WHERE (product IS NOT NULL);
19112
8031
CREATE INDEX oauthaccesstoken__project__idx ON oauthaccesstoken USING btree (project) WHERE (project IS NOT NULL);
19115
8033
CREATE INDEX oauthnonce__access_token__idx ON oauthnonce USING btree (access_token);
19118
8035
CREATE INDEX oauthnonce__request_timestamp__idx ON oauthnonce USING btree (request_timestamp);
19121
8037
CREATE INDEX oauthrequesttoken__consumer__idx ON oauthrequesttoken USING btree (consumer);
19124
8039
CREATE INDEX oauthrequesttoken__date_created__idx ON oauthrequesttoken USING btree (date_created);
19127
8041
CREATE INDEX oauthrequesttoken__distribution__sourcepackagename__idx ON oauthrequesttoken USING btree (distribution, sourcepackagename) WHERE (distribution IS NOT NULL);
19130
8043
CREATE INDEX oauthrequesttoken__person__idx ON oauthrequesttoken USING btree (person) WHERE (person IS NOT NULL);
19133
8045
CREATE INDEX oauthrequesttoken__product__idx ON oauthrequesttoken USING btree (product) WHERE (product IS NOT NULL);
19136
8047
CREATE INDEX oauthrequesttoken__project__idx ON oauthrequesttoken USING btree (project) WHERE (project IS NOT NULL);
19139
8049
CREATE UNIQUE INDEX officialbugtag__distribution__tag__key ON officialbugtag USING btree (distribution, tag) WHERE (distribution IS NOT NULL);
19142
8051
CREATE UNIQUE INDEX officialbugtag__product__tag__key ON officialbugtag USING btree (product, tag) WHERE (product IS NOT NULL);
19145
8053
CREATE UNIQUE INDEX officialbugtag__project__tag__key ON officialbugtag USING btree (project, tag) WHERE (product IS NOT NULL);
19148
CREATE INDEX openididentifier__account__idx ON openididentifier USING btree (account);
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);
19151
8065
CREATE INDEX packagebuild__archive__idx ON packagebuild USING btree (archive);
19154
8067
CREATE UNIQUE INDEX packagebuild__build_farm_job__idx ON packagebuild USING btree (build_farm_job);
19157
8069
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);
19169
8071
CREATE INDEX packagecopyrequest__datecreated__idx ON packagecopyrequest USING btree (date_created);
19172
8073
CREATE INDEX packagecopyrequest__requester__idx ON packagecopyrequest USING btree (requester);
19175
8075
CREATE INDEX packagecopyrequest__targetarchive__idx ON packagecopyrequest USING btree (target_archive);
19178
8077
CREATE INDEX packagecopyrequest__targetdistroseries__idx ON packagecopyrequest USING btree (target_distroseries) WHERE (target_distroseries IS NOT NULL);
19181
8079
CREATE INDEX packagediff__diff_content__idx ON packagediff USING btree (diff_content);
19184
8081
CREATE INDEX packagediff__from_source__idx ON packagediff USING btree (from_source);
19187
8083
CREATE INDEX packagediff__requester__idx ON packagediff USING btree (requester);
19190
8085
CREATE INDEX packagediff__status__idx ON packagediff USING btree (status);
19193
8087
CREATE INDEX packagediff__to_source__idx ON packagediff USING btree (to_source);
19196
8089
CREATE INDEX packageset__distroseries__idx ON packageset USING btree (distroseries);
19199
8091
CREATE INDEX packageset__owner__idx ON packageset USING btree (owner);
19202
8093
CREATE INDEX packageset__packagesetgroup__idx ON packageset USING btree (packagesetgroup);
19205
8095
CREATE INDEX packagesetgroup__owner__idx ON packagesetgroup USING btree (owner);
19208
8097
CREATE INDEX packagesetinclusion__child__idx ON packagesetinclusion USING btree (child);
19211
8099
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);
19217
8101
CREATE INDEX packageupload__changesfile__idx ON packageupload USING btree (changesfile);
19220
8103
CREATE INDEX packageupload__distroseries__key ON packageupload USING btree (distroseries);
19223
8105
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);
19229
8107
CREATE INDEX packageupload__signing_key__idx ON packageupload USING btree (signing_key);
19232
8109
CREATE INDEX packageuploadbuild__build__idx ON packageuploadbuild USING btree (build);
19235
8111
CREATE INDEX packageuploadcustom__libraryfilealias__idx ON packageuploadcustom USING btree (libraryfilealias);
19238
8113
CREATE INDEX packageuploadcustom__packageupload__idx ON packageuploadcustom USING btree (packageupload);
19241
8115
CREATE INDEX packageuploadsource__sourcepackagerelease__idx ON packageuploadsource USING btree (sourcepackagerelease);
8117
CREATE INDEX packaging__distroseries__sourcepackagename__idx ON packaging USING btree (distroseries, sourcepackagename);
19244
8119
CREATE INDEX packaging__owner__idx ON packaging USING btree (owner);
19247
8121
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);
19256
8123
CREATE INDEX parsedapachelog__first_line__idx ON parsedapachelog USING btree (first_line);
19259
CREATE INDEX person__displayname__idx ON person USING btree (lower(displayname));
19262
8125
CREATE INDEX person__icon__idx ON person USING btree (icon) WHERE (icon IS NOT NULL);
19265
8127
CREATE INDEX person__logo__idx ON person USING btree (logo) WHERE (logo IS NOT NULL);
19268
8129
CREATE INDEX person__merged__idx ON person USING btree (merged) WHERE (merged IS NOT NULL);
19271
8131
CREATE INDEX person__mugshot__idx ON person USING btree (mugshot) WHERE (mugshot IS NOT NULL);
19274
8133
CREATE INDEX person__registrant__idx ON person USING btree (registrant);
19277
8135
CREATE INDEX person__teamowner__idx ON person USING btree (teamowner) WHERE (teamowner IS NOT NULL);
19280
8137
CREATE INDEX person_datecreated_idx ON person USING btree (datecreated);
19283
CREATE INDEX person_fti ON person USING gist (fti);
8139
CREATE INDEX person_fti ON person USING gist (fti ts2.gist_tsvector_ops);
19286
8141
CREATE INDEX person_sorting_idx ON person USING btree (person_sort_key(displayname, name));
19289
8143
CREATE INDEX personlocation__last_modified_by__idx ON personlocation USING btree (last_modified_by);
19292
8145
CREATE INDEX personnotification__date_emailed__idx ON personnotification USING btree (date_emailed);
19295
8147
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);
19304
8149
CREATE INDEX pillarname__alias_for__idx ON pillarname USING btree (alias_for) WHERE (alias_for IS NOT NULL);
19307
8151
CREATE UNIQUE INDEX pillarname__distribution__key ON pillarname USING btree (distribution) WHERE (distribution IS NOT NULL);
19310
8153
CREATE UNIQUE INDEX pillarname__product__key ON pillarname USING btree (product) WHERE (product IS NOT NULL);
19313
8155
CREATE UNIQUE INDEX pillarname__project__key ON pillarname USING btree (project) WHERE (project IS NOT NULL);
19316
8157
CREATE INDEX pocketchroot__chroot__idx ON pocketchroot USING btree (chroot);
8159
CREATE INDEX pocomment_person_idx ON pocomment USING btree (person);
19319
8161
CREATE INDEX poexportrequest__person__idx ON poexportrequest USING btree (person);
19322
8163
CREATE UNIQUE INDEX poexportrequest_duplicate_key ON poexportrequest USING btree (potemplate, person, format, (COALESCE(pofile, (-1))));
19325
8165
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);
19331
8167
CREATE UNIQUE INDEX pofile__potemplate__path__key ON pofile USING btree (potemplate, path);
19334
8169
CREATE UNIQUE INDEX pofile__unreviewed_count__id__key ON pofile USING btree (unreviewed_count, id);
19337
8171
CREATE INDEX pofile_datecreated_idx ON pofile USING btree (datecreated);
19340
8173
CREATE INDEX pofile_language_idx ON pofile USING btree (language);
19343
8175
CREATE INDEX pofile_lasttranslator_idx ON pofile USING btree (lasttranslator);
19346
8177
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);
19349
8185
CREATE INDEX pofiletranslator__date_last_touched__idx ON pofiletranslator USING btree (date_last_touched);
19352
8187
CREATE INDEX pofiletranslator__latest_message__idx ON pofiletranslator USING btree (latest_message);
19355
8189
CREATE INDEX pofiletranslator__pofile__idx ON pofiletranslator USING btree (pofile);
19358
8191
CREATE INDEX polloption_poll_idx ON polloption USING btree (poll);
19361
8193
CREATE UNIQUE INDEX pomsgid_msgid_key ON pomsgid USING btree (sha1(msgid));
19364
8195
CREATE INDEX potemplate__date_last_updated__idx ON potemplate USING btree (date_last_updated);
19367
8197
CREATE UNIQUE INDEX potemplate__distroseries__sourcepackagename__name__key ON potemplate USING btree (distroseries, sourcepackagename, name);
19370
8199
CREATE INDEX potemplate__name__idx ON potemplate USING btree (name);
19373
8201
CREATE UNIQUE INDEX potemplate__productseries__name__key ON potemplate USING btree (productseries, name);
19376
8203
CREATE INDEX potemplate__source_file__idx ON potemplate USING btree (source_file) WHERE (source_file IS NOT NULL);
19379
8205
CREATE INDEX potemplate_languagepack_idx ON potemplate USING btree (languagepack);
19382
8207
CREATE INDEX potemplate_owner_idx ON potemplate USING btree (owner);
19385
8209
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));
19388
8211
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));
19391
8213
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));
19394
8215
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);
19400
8217
CREATE INDEX potmsgset_primemsgid_idx ON potmsgset USING btree (msgid_singular);
8219
CREATE INDEX potmsgset_sequence_idx ON potmsgset USING btree (sequence);
19403
8221
CREATE UNIQUE INDEX potranslation_translation_key ON potranslation USING btree (sha1(translation));
19406
8223
CREATE INDEX previewdiff__diff__idx ON previewdiff USING btree (diff);
19409
8225
CREATE INDEX product__bug_supervisor__idx ON product USING btree (bug_supervisor) WHERE (bug_supervisor IS NOT NULL);
19412
8227
CREATE INDEX product__driver__idx ON product USING btree (driver) WHERE (driver IS NOT NULL);
19415
8229
CREATE INDEX product__icon__idx ON product USING btree (icon) WHERE (icon IS NOT NULL);
19418
8231
CREATE INDEX product__logo__idx ON product USING btree (logo) WHERE (logo IS NOT NULL);
19421
8233
CREATE INDEX product__mugshot__idx ON product USING btree (mugshot) WHERE (mugshot IS NOT NULL);
19424
8235
CREATE INDEX product__registrant__idx ON product USING btree (registrant);
19427
8237
CREATE INDEX product__security_contact__idx ON product USING btree (security_contact) WHERE (security_contact IS NOT NULL);
19430
8239
CREATE INDEX product_active_idx ON product USING btree (active);
19433
CREATE INDEX product_fti ON product USING gist (fti);
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);
19436
8245
CREATE INDEX product_owner_idx ON product USING btree (owner);
19439
8247
CREATE INDEX product_project_idx ON product USING btree (project);
19442
8249
CREATE INDEX product_translationgroup_idx ON product USING btree (translationgroup);
19445
8251
CREATE INDEX productlicense__license__idx ON productlicense USING btree (license);
19448
8253
CREATE INDEX productrelease_datecreated_idx ON productrelease USING btree (datecreated);
19451
8255
CREATE INDEX productrelease_owner_idx ON productrelease USING btree (owner);
19454
8257
CREATE INDEX productreleasefile__libraryfile__idx ON productreleasefile USING btree (libraryfile);
19457
8259
CREATE INDEX productreleasefile__signature__idx ON productreleasefile USING btree (signature) WHERE (signature IS NOT NULL);
19460
8261
CREATE INDEX productreleasefile__uploader__idx ON productreleasefile USING btree (uploader);
19463
CREATE INDEX productreleasefile_fti ON productreleasefile USING gist (fti);
8263
CREATE INDEX productreleasefile_fti ON productreleasefile USING gist (fti ts2.gist_tsvector_ops);
19466
8265
CREATE INDEX productseries__branch__idx ON productseries USING btree (branch) WHERE (branch IS NOT NULL);
19469
8267
CREATE INDEX productseries__driver__idx ON productseries USING btree (driver);
19472
8269
CREATE INDEX productseries__owner__idx ON productseries USING btree (owner);
19475
8271
CREATE INDEX productseries__translations_branch__idx ON productseries USING btree (translations_branch);
19478
8273
CREATE INDEX productseries_datecreated_idx ON productseries USING btree (datecreated);
19481
CREATE INDEX productseries_name_sort ON productseries USING btree (version_sort_key(name));
19484
8275
CREATE INDEX project__driver__idx ON project USING btree (driver);
19487
8277
CREATE INDEX project__icon__idx ON project USING btree (icon) WHERE (icon IS NOT NULL);
19490
8279
CREATE INDEX project__logo__idx ON project USING btree (logo) WHERE (logo IS NOT NULL);
19493
8281
CREATE INDEX project__mugshot__idx ON project USING btree (mugshot) WHERE (mugshot IS NOT NULL);
19496
8283
CREATE INDEX project__registrant__idx ON project USING btree (registrant);
19499
CREATE INDEX project_fti ON project USING gist (fti);
8285
CREATE INDEX project_fti ON project USING gist (fti ts2.gist_tsvector_ops);
19502
8287
CREATE INDEX project_owner_idx ON project USING btree (owner);
19505
8289
CREATE INDEX project_translationgroup_idx ON project USING btree (translationgroup);
19508
CREATE UNIQUE INDEX publisherconfig__distribution__idx ON publisherconfig USING btree (distribution);
8291
CREATE INDEX pushmirroraccess_person_idx ON pushmirroraccess USING btree (person);
19511
8293
CREATE INDEX question__answerer__idx ON question USING btree (answerer);
19514
8295
CREATE INDEX question__assignee__idx ON question USING btree (assignee);
19517
8297
CREATE INDEX question__distribution__sourcepackagename__idx ON question USING btree (distribution, sourcepackagename);
19520
8299
CREATE INDEX question__distro__datecreated__idx ON question USING btree (distribution, datecreated);
19523
8301
CREATE INDEX question__faq__idx ON question USING btree (faq) WHERE (faq IS NOT NULL);
19526
8303
CREATE INDEX question__owner__idx ON question USING btree (owner);
19529
8305
CREATE INDEX question__product__datecreated__idx ON question USING btree (product, datecreated);
19532
8307
CREATE INDEX question__product__idx ON question USING btree (product);
19535
8309
CREATE INDEX question__status__datecreated__idx ON question USING btree (status, datecreated);
19538
CREATE INDEX question_fti ON question USING gist (fti);
8311
CREATE INDEX question_fti ON question USING gist (fti ts2.gist_tsvector_ops);
19541
8313
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);
19550
8315
CREATE INDEX questionmessage__question__idx ON questionmessage USING btree (question);
19553
8317
CREATE INDEX questionreopening__answerer__idx ON questionreopening USING btree (answerer);
19556
8319
CREATE INDEX questionreopening__datecreated__idx ON questionreopening USING btree (datecreated);
19559
8321
CREATE INDEX questionreopening__question__idx ON questionreopening USING btree (question);
19562
8323
CREATE INDEX questionreopening__reopener__idx ON questionreopening USING btree (reopener);
19565
8325
CREATE INDEX questionsubscription__subscriber__idx ON questionsubscription USING btree (person);
8327
CREATE INDEX requestedcds_request_architecture_idx ON requestedcds USING btree (request, architecture);
19568
8329
CREATE INDEX revision__gpgkey__idx ON revision USING btree (gpgkey) WHERE (gpgkey IS NOT NULL);
19571
8331
CREATE INDEX revision__karma_allocated__idx ON revision USING btree (karma_allocated) WHERE (karma_allocated IS FALSE);
19574
8333
CREATE INDEX revision__revision_author__idx ON revision USING btree (revision_author);
19577
8335
CREATE INDEX revision__revision_date__idx ON revision USING btree (revision_date);
19580
8337
CREATE INDEX revisionauthor__email__idx ON revisionauthor USING btree (email);
19583
8339
CREATE INDEX revisionauthor__lower_email__idx ON revisionauthor USING btree (lower(email));
19586
8341
CREATE INDEX revisionauthor__person__idx ON revisionauthor USING btree (person);
19589
8343
CREATE UNIQUE INDEX revisioncache__distroseries__sourcepackagename__revision__priva ON revisioncache USING btree (distroseries, sourcepackagename, revision, private) WHERE (distroseries IS NOT NULL);
19592
8345
CREATE UNIQUE INDEX revisioncache__product__revision__private__key ON revisioncache USING btree (product, revision, private) WHERE (product IS NOT NULL);
19595
8347
CREATE INDEX revisioncache__revision__idx ON revisioncache USING btree (revision);
19598
8349
CREATE INDEX revisioncache__revision_author__idx ON revisioncache USING btree (revision_author);
19601
8351
CREATE INDEX revisioncache__revision_date__idx ON revisioncache USING btree (revision_date);
19604
8353
CREATE INDEX sbpph__dateremoved__idx ON binarypackagepublishinghistory USING btree (dateremoved) WHERE (dateremoved IS NOT NULL);
19607
8355
CREATE INDEX scriptactivity__name__date_started__idx ON scriptactivity USING btree (name, date_started);
19610
8357
CREATE INDEX securebinarypackagepublishinghistory__archive__status__idx ON binarypackagepublishinghistory USING btree (archive, status);
19613
8359
CREATE INDEX securebinarypackagepublishinghistory__distroarchseries__idx ON binarypackagepublishinghistory USING btree (distroarchseries);
19616
8361
CREATE INDEX securebinarypackagepublishinghistory__removed_by__idx ON binarypackagepublishinghistory USING btree (removed_by) WHERE (removed_by IS NOT NULL);
19619
8363
CREATE INDEX securebinarypackagepublishinghistory__supersededby__idx ON binarypackagepublishinghistory USING btree (supersededby);
19622
8365
CREATE INDEX securebinarypackagepublishinghistory_binarypackagerelease_idx ON binarypackagepublishinghistory USING btree (binarypackagerelease);
19625
8367
CREATE INDEX securebinarypackagepublishinghistory_component_idx ON binarypackagepublishinghistory USING btree (component);
19628
8369
CREATE INDEX securebinarypackagepublishinghistory_pocket_idx ON binarypackagepublishinghistory USING btree (pocket);
19631
8371
CREATE INDEX securebinarypackagepublishinghistory_section_idx ON binarypackagepublishinghistory USING btree (section);
19634
8373
CREATE INDEX securebinarypackagepublishinghistory_status_idx ON binarypackagepublishinghistory USING btree (status);
19637
8375
CREATE INDEX securesourcepackagepublishinghistory__archive__status__idx ON sourcepackagepublishinghistory USING btree (archive, status);
19640
8377
CREATE INDEX securesourcepackagepublishinghistory__distroseries__idx ON sourcepackagepublishinghistory USING btree (distroseries);
19643
8379
CREATE INDEX securesourcepackagepublishinghistory__removed_by__idx ON sourcepackagepublishinghistory USING btree (removed_by) WHERE (removed_by IS NOT NULL);
19646
8381
CREATE INDEX securesourcepackagepublishinghistory_component_idx ON sourcepackagepublishinghistory USING btree (component);
19649
8383
CREATE INDEX securesourcepackagepublishinghistory_pocket_idx ON sourcepackagepublishinghistory USING btree (pocket);
19652
8385
CREATE INDEX securesourcepackagepublishinghistory_section_idx ON sourcepackagepublishinghistory USING btree (section);
19655
8387
CREATE INDEX securesourcepackagepublishinghistory_sourcepackagerelease_idx ON sourcepackagepublishinghistory USING btree (sourcepackagerelease);
19658
8389
CREATE INDEX securesourcepackagepublishinghistory_status_idx ON sourcepackagepublishinghistory USING btree (status);
19661
8391
CREATE INDEX seriessourcepackagebranch__branch__idx ON seriessourcepackagebranch USING btree (branch);
19664
8393
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);
19667
8427
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);
19679
8429
CREATE INDEX sourcepackagerecipe__daily_build_archive__idx ON sourcepackagerecipe USING btree (daily_build_archive);
19682
8431
CREATE INDEX sourcepackagerecipe__is_stale__build_daily__idx ON sourcepackagerecipe USING btree (is_stale, build_daily);
19685
8433
CREATE INDEX sourcepackagerecipe__registrant__idx ON sourcepackagerecipe USING btree (registrant);
19688
8435
CREATE INDEX sourcepackagerecipebuild__distroseries__idx ON sourcepackagerecipebuild USING btree (distroseries);
19691
8437
CREATE INDEX sourcepackagerecipebuild__manifest__idx ON sourcepackagerecipebuild USING btree (manifest);
19694
8439
CREATE INDEX sourcepackagerecipebuild__recipe__idx ON sourcepackagerecipebuild USING btree (recipe);
19697
8441
CREATE INDEX sourcepackagerecipebuild__requester__idx ON sourcepackagerecipebuild USING btree (requester);
19700
8443
CREATE INDEX sourcepackagerecipedata__base_branch__idx ON sourcepackagerecipedata USING btree (base_branch);
19703
8445
CREATE UNIQUE INDEX sourcepackagerecipedata__sourcepackage_recipe__key ON sourcepackagerecipedata USING btree (sourcepackage_recipe) WHERE (sourcepackage_recipe IS NOT NULL);
19706
8447
CREATE UNIQUE INDEX sourcepackagerecipedata__sourcepackage_recipe_build__key ON sourcepackagerecipedata USING btree (sourcepackage_recipe_build) WHERE (sourcepackage_recipe_build IS NOT NULL);
19709
8449
CREATE INDEX sourcepackagerecipedatainstruction__branch__idx ON sourcepackagerecipedatainstruction USING btree (branch);
19712
8451
CREATE INDEX sourcepackagerelease__changelog__idx ON sourcepackagerelease USING btree (changelog);
19715
8453
CREATE INDEX sourcepackagerelease__sourcepackage_recipe_build__idx ON sourcepackagerelease USING btree (sourcepackage_recipe_build);
19718
8455
CREATE INDEX sourcepackagerelease__upload_archive__idx ON sourcepackagerelease USING btree (upload_archive);
19721
CREATE INDEX sourcepackagerelease__version__idx ON sourcepackagerelease USING btree (version);
19724
8457
CREATE INDEX sourcepackagerelease_creator_idx ON sourcepackagerelease USING btree (creator);
19727
8459
CREATE INDEX sourcepackagerelease_maintainer_idx ON sourcepackagerelease USING btree (maintainer);
19730
8461
CREATE INDEX sourcepackagerelease_sourcepackagename_idx ON sourcepackagerelease USING btree (sourcepackagename);
8463
CREATE INDEX sourcepackagerelease_version_sort ON sourcepackagerelease USING btree (debversion_sort_key(version));
19733
8465
CREATE INDEX sourcepackagereleasefile_libraryfile_idx ON sourcepackagereleasefile USING btree (libraryfile);
19736
8467
CREATE INDEX sourcepackagereleasefile_sourcepackagerelease_idx ON sourcepackagereleasefile USING btree (sourcepackagerelease);
19739
8469
CREATE INDEX specification__completer__idx ON specification USING btree (completer);
19742
8471
CREATE INDEX specification__goal_decider__idx ON specification USING btree (goal_decider);
19745
8473
CREATE INDEX specification__goal_proposer__idx ON specification USING btree (goal_proposer);
19748
8475
CREATE INDEX specification__starter__idx ON specification USING btree (starter);
19751
8477
CREATE INDEX specification_approver_idx ON specification USING btree (approver);
19754
8479
CREATE INDEX specification_assignee_idx ON specification USING btree (assignee);
19757
8481
CREATE INDEX specification_datecreated_idx ON specification USING btree (datecreated);
19760
8483
CREATE INDEX specification_drafter_idx ON specification USING btree (drafter);
19763
CREATE INDEX specification_fti ON specification USING gist (fti);
8485
CREATE INDEX specification_fti ON specification USING gist (fti ts2.gist_tsvector_ops);
19766
8487
CREATE INDEX specification_owner_idx ON specification USING btree (owner);
19769
8489
CREATE INDEX specificationbranch__registrant__idx ON specificationbranch USING btree (registrant);
19772
8491
CREATE INDEX specificationbranch__specification__idx ON specificationbranch USING btree (specification);
19775
8493
CREATE INDEX specificationbug_bug_idx ON specificationbug USING btree (bug);
19778
8495
CREATE INDEX specificationbug_specification_idx ON specificationbug USING btree (specification);
19781
8497
CREATE INDEX specificationdependency_dependency_idx ON specificationdependency USING btree (dependency);
19784
8499
CREATE INDEX specificationdependency_specification_idx ON specificationdependency USING btree (specification);
19787
8501
CREATE INDEX specificationfeedback_requester_idx ON specificationfeedback USING btree (requester);
19790
8503
CREATE INDEX specificationfeedback_reviewer_idx ON specificationfeedback USING btree (reviewer);
19793
8505
CREATE INDEX specificationsubscription_specification_idx ON specificationsubscription USING btree (specification);
19796
8507
CREATE INDEX specificationsubscription_subscriber_idx ON specificationsubscription USING btree (person);
19799
8509
CREATE INDEX sprint__driver__idx ON sprint USING btree (driver);
19802
8511
CREATE INDEX sprint__icon__idx ON sprint USING btree (icon) WHERE (icon IS NOT NULL);
19805
8513
CREATE INDEX sprint__logo__idx ON sprint USING btree (logo) WHERE (logo IS NOT NULL);
19808
8515
CREATE INDEX sprint__mugshot__idx ON sprint USING btree (mugshot) WHERE (mugshot IS NOT NULL);
19811
8517
CREATE INDEX sprint__owner__idx ON sprint USING btree (owner);
19814
8519
CREATE INDEX sprint_datecreated_idx ON sprint USING btree (datecreated);
19817
8521
CREATE INDEX sprintattendance_sprint_idx ON sprintattendance USING btree (sprint);
19820
8523
CREATE INDEX sprintspec_sprint_idx ON sprintspecification USING btree (sprint);
19823
8525
CREATE INDEX sprintspecification__decider__idx ON sprintspecification USING btree (decider);
19826
8527
CREATE INDEX sprintspecification__registrant__idx ON sprintspecification USING btree (registrant);
19829
8529
CREATE INDEX sshkey_person_key ON sshkey USING btree (person);
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);
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);
19853
8549
CREATE INDEX structuralsubscription__subscribed_by__idx ON structuralsubscription USING btree (subscribed_by);
19856
8551
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);
19868
8553
CREATE INDEX teammembership__acknowledged_by__idx ON teammembership USING btree (acknowledged_by) WHERE (acknowledged_by IS NOT NULL);
19871
8555
CREATE INDEX teammembership__last_changed_by__idx ON teammembership USING btree (last_changed_by) WHERE (last_changed_by IS NOT NULL);
19874
8557
CREATE INDEX teammembership__proposed_by__idx ON teammembership USING btree (proposed_by) WHERE (proposed_by IS NOT NULL);
19877
8559
CREATE INDEX teammembership__reviewed_by__idx ON teammembership USING btree (reviewed_by) WHERE (reviewed_by IS NOT NULL);
19880
8561
CREATE INDEX teammembership__team__idx ON teammembership USING btree (team);
19883
8563
CREATE INDEX teamparticipation_person_idx ON teamparticipation USING btree (person);
19885
8565
ALTER TABLE teamparticipation CLUSTER ON teamparticipation_person_idx;
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));
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));
19903
8585
CREATE INDEX translationgroup__owner__idx ON translationgroup USING btree (owner);
19906
8587
CREATE INDEX translationimportqueueentry__content__idx ON translationimportqueueentry USING btree (content) WHERE (content IS NOT NULL);
19909
8589
CREATE INDEX translationimportqueueentry__context__path__idx ON translationimportqueueentry USING btree (distroseries, sourcepackagename, productseries, path);
19912
8591
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))));
19915
8593
CREATE INDEX translationimportqueueentry__path__idx ON translationimportqueueentry USING btree (path);
19918
8595
CREATE INDEX translationimportqueueentry__pofile__idx ON translationimportqueueentry USING btree (pofile) WHERE (pofile IS NOT NULL);
19921
8597
CREATE INDEX translationimportqueueentry__potemplate__idx ON translationimportqueueentry USING btree (potemplate) WHERE (potemplate IS NOT NULL);
19924
8599
CREATE INDEX translationimportqueueentry__productseries__idx ON translationimportqueueentry USING btree (productseries) WHERE (productseries IS NOT NULL);
19927
8601
CREATE INDEX translationimportqueueentry__sourcepackagename__idx ON translationimportqueueentry USING btree (sourcepackagename) WHERE (sourcepackagename IS NOT NULL);
19930
8603
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);
19933
8609
CREATE INDEX translationmessage__msgstr0__idx ON translationmessage USING btree (msgstr0);
19936
8611
CREATE INDEX translationmessage__msgstr1__idx ON translationmessage USING btree (msgstr1) WHERE (msgstr1 IS NOT NULL);
19939
8613
CREATE INDEX translationmessage__msgstr2__idx ON translationmessage USING btree (msgstr2) WHERE (msgstr2 IS NOT NULL);
19942
8615
CREATE INDEX translationmessage__msgstr3__idx ON translationmessage USING btree (msgstr3) WHERE (msgstr3 IS NOT NULL);
19945
8617
CREATE INDEX translationmessage__msgstr4__idx ON translationmessage USING btree (msgstr4) WHERE (msgstr4 IS NOT NULL);
19948
8619
CREATE INDEX translationmessage__msgstr5__idx ON translationmessage USING btree (msgstr5) WHERE (msgstr5 IS NOT NULL);
19951
CREATE INDEX translationmessage__potemplate__idx ON translationmessage USING btree (potemplate) WHERE (potemplate IS NOT NULL);
8621
CREATE INDEX translationmessage__pofile__idx ON translationmessage USING btree (pofile);
19954
8623
CREATE INDEX translationmessage__potmsgset__idx ON translationmessage USING btree (potmsgset);
19957
8625
CREATE INDEX translationmessage__potmsgset__language__idx ON translationmessage USING btree (potmsgset, language);
19960
8627
CREATE INDEX translationmessage__reviewer__idx ON translationmessage USING btree (reviewer);
19963
8629
CREATE INDEX translationmessage__submitter__idx ON translationmessage USING btree (submitter);
19966
8631
CREATE UNIQUE INDEX translationtemplateitem__potemplate__potmsgset__key ON translationtemplateitem USING btree (potemplate, potmsgset);
19969
8633
CREATE INDEX translationtemplateitem__potemplate__sequence__idx ON translationtemplateitem USING btree (potemplate, sequence);
19972
8635
CREATE UNIQUE INDEX translationtemplateitem__potemplate__sequence__key ON translationtemplateitem USING btree (potemplate, sequence) WHERE (sequence > 0);
19975
8637
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);
19984
8639
CREATE INDEX translator__translator__idx ON translator USING btree (translator);
19987
8641
CREATE INDEX usertouseremail__recipient__idx ON usertouseremail USING btree (recipient);
19990
8643
CREATE INDEX usertouseremail__sender__date_sent__idx ON usertouseremail USING btree (sender, date_sent);
19993
8645
CREATE INDEX vote__person__idx ON vote USING btree (person);
19996
8647
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));
19999
8663
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);
20002
8671
CREATE TRIGGER bug_latest_patch_uploaded_on_delete_t
20003
8672
AFTER DELETE ON bugattachment
20005
8674
EXECUTE PROCEDURE bug_update_latest_patch_uploaded_on_delete();
20008
8676
CREATE TRIGGER bug_latest_patch_uploaded_on_insert_update_t
20009
8677
AFTER INSERT OR UPDATE ON bugattachment
20011
8679
EXECUTE PROCEDURE bug_update_latest_patch_uploaded_on_insert_update();
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();
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();
20086
8696
CREATE TRIGGER lp_mirror_person_del_t
20087
8697
AFTER DELETE ON person
20089
8699
EXECUTE PROCEDURE lp_mirror_del();
20092
8701
CREATE TRIGGER lp_mirror_person_ins_t
20093
8702
AFTER INSERT ON person
20095
8704
EXECUTE PROCEDURE lp_mirror_person_ins();
20098
8706
CREATE TRIGGER lp_mirror_person_upd_t
20099
8707
AFTER UPDATE ON person
20101
8709
EXECUTE PROCEDURE lp_mirror_person_upd();
20104
8711
CREATE TRIGGER lp_mirror_personlocation_del_t
20105
8712
AFTER DELETE ON teamparticipation
20107
8714
EXECUTE PROCEDURE lp_mirror_del();
20110
8716
CREATE TRIGGER lp_mirror_personlocation_ins_t
20111
8717
AFTER INSERT ON personlocation
20113
8719
EXECUTE PROCEDURE lp_mirror_personlocation_ins();
20116
8721
CREATE TRIGGER lp_mirror_personlocation_upd_t
20117
8722
AFTER UPDATE ON personlocation
20119
8724
EXECUTE PROCEDURE lp_mirror_personlocation_upd();
20122
8726
CREATE TRIGGER lp_mirror_teamparticipation_del_t
20123
8727
AFTER DELETE ON teamparticipation
20125
8729
EXECUTE PROCEDURE lp_mirror_del();
20128
8731
CREATE TRIGGER lp_mirror_teamparticipation_ins_t
20129
8732
AFTER INSERT ON teamparticipation
20131
8734
EXECUTE PROCEDURE lp_mirror_teamparticipation_ins();
20134
8736
CREATE TRIGGER lp_mirror_teamparticipation_upd_t
20135
8737
AFTER UPDATE ON teamparticipation
20137
8739
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();
20158
8741
CREATE TRIGGER mv_branch_distribution_update_t
20159
8742
AFTER UPDATE ON distribution
20161
8744
EXECUTE PROCEDURE mv_branch_distribution_update();
20164
8746
CREATE TRIGGER mv_branch_distroseries_update_t
20165
8747
AFTER UPDATE ON distroseries
20167
8749
EXECUTE PROCEDURE mv_branch_distroseries_update();
20170
8751
CREATE TRIGGER mv_branch_person_update_t
20171
8752
AFTER UPDATE ON person
20173
8754
EXECUTE PROCEDURE mv_branch_person_update();
20176
8756
CREATE TRIGGER mv_branch_product_update_t
20177
8757
AFTER UPDATE ON product
20179
8759
EXECUTE PROCEDURE mv_branch_product_update();
20182
8761
CREATE TRIGGER mv_pillarname_distribution_t
20183
8762
AFTER INSERT OR UPDATE ON distribution
20185
8764
EXECUTE PROCEDURE mv_pillarname_distribution();
20188
8766
CREATE TRIGGER mv_pillarname_product_t
20189
8767
AFTER INSERT OR UPDATE ON product
20191
8769
EXECUTE PROCEDURE mv_pillarname_product();
20194
8771
CREATE TRIGGER mv_pillarname_project_t
20195
8772
AFTER INSERT OR UPDATE ON project
20197
8774
EXECUTE PROCEDURE mv_pillarname_project();
20200
8776
CREATE TRIGGER mv_pofiletranslator_translationmessage
20201
8777
AFTER INSERT OR DELETE OR UPDATE ON translationmessage
20203
8779
EXECUTE PROCEDURE mv_pofiletranslator_translationmessage();
20206
8781
CREATE TRIGGER packageset_deleted_trig
20207
8782
BEFORE DELETE ON packageset
20209
8784
EXECUTE PROCEDURE packageset_deleted_trig();
20212
8786
CREATE TRIGGER packageset_inserted_trig
20213
8787
AFTER INSERT ON packageset
20215
8789
EXECUTE PROCEDURE packageset_inserted_trig();
20218
8791
CREATE TRIGGER packagesetinclusion_deleted_trig
20219
8792
BEFORE DELETE ON packagesetinclusion
20221
8794
EXECUTE PROCEDURE packagesetinclusion_deleted_trig();
20224
8796
CREATE TRIGGER packagesetinclusion_inserted_trig
20225
8797
AFTER INSERT ON packagesetinclusion
20227
8799
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();
20236
8801
CREATE TRIGGER set_bug_message_count_t
20237
8802
AFTER INSERT OR DELETE OR UPDATE ON bugmessage
20239
8804
EXECUTE PROCEDURE set_bug_message_count();
20242
8806
CREATE TRIGGER set_bug_number_of_duplicates_t
20243
8807
AFTER INSERT OR DELETE OR UPDATE ON bug
20245
8809
EXECUTE PROCEDURE set_bug_number_of_duplicates();
20248
8811
CREATE TRIGGER set_bug_users_affected_count_t
20249
8812
AFTER INSERT OR DELETE OR UPDATE ON bugaffectsperson
20251
8814
EXECUTE PROCEDURE set_bug_users_affected_count();
20254
8816
CREATE TRIGGER set_bugtask_date_milestone_set_t
20255
8817
AFTER INSERT OR UPDATE ON bugtask
20257
8819
EXECUTE PROCEDURE set_bugtask_date_milestone_set();
20260
8821
CREATE TRIGGER set_date_last_message_t
20261
8822
AFTER INSERT OR DELETE OR UPDATE ON bugmessage
20263
8824
EXECUTE PROCEDURE set_bug_date_last_message();
20266
8826
CREATE TRIGGER set_date_status_set_t
20267
8827
BEFORE UPDATE ON account
20269
8829
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');
20272
8841
CREATE TRIGGER tsvectorupdate
20273
8842
BEFORE INSERT OR UPDATE ON binarypackagerelease
20275
8844
EXECUTE PROCEDURE ts2.ftiupdate('summary', 'b', 'description', 'c');
20278
8846
CREATE TRIGGER tsvectorupdate
20279
8847
BEFORE INSERT OR UPDATE ON cve
20281
8849
EXECUTE PROCEDURE ts2.ftiupdate('sequence', 'a', 'description', 'b');
20284
8851
CREATE TRIGGER tsvectorupdate
20285
8852
BEFORE INSERT OR UPDATE ON distroseriespackagecache
20287
8854
EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'summaries', 'b', 'descriptions', 'c');
20290
8856
CREATE TRIGGER tsvectorupdate
20291
8857
BEFORE INSERT OR UPDATE ON message
20293
8859
EXECUTE PROCEDURE ts2.ftiupdate('subject', 'b');
20296
8861
CREATE TRIGGER tsvectorupdate
20297
8862
BEFORE INSERT OR UPDATE ON messagechunk
20299
8864
EXECUTE PROCEDURE ts2.ftiupdate('content', 'c');
20302
8866
CREATE TRIGGER tsvectorupdate
20303
8867
BEFORE INSERT OR UPDATE ON product
20305
8869
EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'displayname', 'a', 'title', 'b', 'summary', 'c', 'description', 'd');
20308
8871
CREATE TRIGGER tsvectorupdate
20309
8872
BEFORE INSERT OR UPDATE ON project
20311
8874
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');
20314
8881
CREATE TRIGGER tsvectorupdate
20315
8882
BEFORE INSERT OR UPDATE ON question
20317
8884
EXECUTE PROCEDURE ts2.ftiupdate('title', 'a', 'description', 'b', 'whiteboard', 'b');
20320
8886
CREATE TRIGGER tsvectorupdate
20321
8887
BEFORE INSERT OR UPDATE ON bug
20323
8889
EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'title', 'b', 'description', 'd');
20326
8891
CREATE TRIGGER tsvectorupdate
20327
8892
BEFORE INSERT OR UPDATE ON person
20329
8894
EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'displayname', 'a');
20332
8896
CREATE TRIGGER tsvectorupdate
20333
8897
BEFORE INSERT OR UPDATE ON specification
20335
8899
EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'title', 'a', 'summary', 'b', 'whiteboard', 'd');
20338
8901
CREATE TRIGGER tsvectorupdate
20339
8902
BEFORE INSERT OR UPDATE ON distribution
20341
8904
EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'displayname', 'a', 'title', 'b', 'summary', 'c', 'description', 'd');
20344
8906
CREATE TRIGGER tsvectorupdate
20345
8907
BEFORE INSERT OR UPDATE ON distributionsourcepackagecache
20347
8909
EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'binpkgnames', 'b', 'binpkgsummaries', 'c', 'binpkgdescriptions', 'd', 'changelog', 'd');
20350
8911
CREATE TRIGGER tsvectorupdate
20351
8912
BEFORE INSERT OR UPDATE ON productreleasefile
20353
8914
EXECUTE PROCEDURE ts2.ftiupdate('description', 'd');
20356
8916
CREATE TRIGGER tsvectorupdate
20357
8917
BEFORE INSERT OR UPDATE ON faq
20359
8919
EXECUTE PROCEDURE ts2.ftiupdate('title', 'a', 'tags', 'b', 'content', 'd');
20362
8921
CREATE TRIGGER tsvectorupdate
20363
8922
BEFORE INSERT OR UPDATE ON archive
20365
8924
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');
20374
8926
CREATE TRIGGER update_branch_name_cache_t
20375
8927
BEFORE INSERT OR UPDATE ON branch
20377
8929
EXECUTE PROCEDURE update_branch_name_cache();
20380
8931
CREATE TRIGGER you_are_your_own_member
20381
8932
AFTER INSERT ON person
20383
8934
EXECUTE PROCEDURE you_are_your_own_member();
20386
8936
ALTER TABLE ONLY processor
20387
8937
ADD CONSTRAINT "$1" FOREIGN KEY (family) REFERENCES processorfamily(id);
20390
8939
ALTER TABLE ONLY builder
20391
8940
ADD CONSTRAINT "$1" FOREIGN KEY (processor) REFERENCES processor(id);
20394
8942
ALTER TABLE ONLY distribution
20395
8943
ADD CONSTRAINT "$1" FOREIGN KEY (owner) REFERENCES person(id);
20398
8945
ALTER TABLE ONLY libraryfilealias
20399
8946
ADD CONSTRAINT "$1" FOREIGN KEY (content) REFERENCES libraryfilecontent(id);
20402
8948
ALTER TABLE ONLY productreleasefile
20403
8949
ADD CONSTRAINT "$1" FOREIGN KEY (productrelease) REFERENCES productrelease(id);
20406
8951
ALTER TABLE ONLY spokenin
20407
8952
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);
20410
8960
ALTER TABLE ONLY bugsubscription
20411
8961
ADD CONSTRAINT "$1" FOREIGN KEY (person) REFERENCES person(id);
20414
8963
ALTER TABLE ONLY bugactivity
20415
8964
ADD CONSTRAINT "$1" FOREIGN KEY (bug) REFERENCES bug(id);
20418
8966
ALTER TABLE ONLY sshkey
20419
8967
ADD CONSTRAINT "$1" FOREIGN KEY (person) REFERENCES person(id);
8969
ALTER TABLE ONLY pushmirroraccess
8970
ADD CONSTRAINT "$1" FOREIGN KEY (person) REFERENCES person(id);
20422
8972
ALTER TABLE ONLY polloption
20423
8973
ADD CONSTRAINT "$1" FOREIGN KEY (poll) REFERENCES poll(id);
20426
8975
ALTER TABLE ONLY product
20427
8976
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);
20430
8981
ALTER TABLE ONLY country
20431
8982
ADD CONSTRAINT "$1" FOREIGN KEY (continent) REFERENCES continent(id);
20434
8984
ALTER TABLE ONLY sourcepackagereleasefile
20435
8985
ADD CONSTRAINT "$1" FOREIGN KEY (sourcepackagerelease) REFERENCES sourcepackagerelease(id) ON DELETE CASCADE;
20438
8987
ALTER TABLE ONLY builder
20439
8988
ADD CONSTRAINT "$2" FOREIGN KEY (owner) REFERENCES person(id);
20442
8990
ALTER TABLE ONLY productreleasefile
20443
8991
ADD CONSTRAINT "$2" FOREIGN KEY (libraryfile) REFERENCES libraryfilealias(id);
20446
8993
ALTER TABLE ONLY sourcepackagereleasefile
20447
8994
ADD CONSTRAINT "$2" FOREIGN KEY (libraryfile) REFERENCES libraryfilealias(id);
20450
8996
ALTER TABLE ONLY spokenin
20451
8997
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);
20454
9005
ALTER TABLE ONLY bugsubscription
20455
9006
ADD CONSTRAINT "$2" FOREIGN KEY (bug) REFERENCES bug(id);
20458
9008
ALTER TABLE ONLY buildqueue
20459
9009
ADD CONSTRAINT "$2" FOREIGN KEY (builder) REFERENCES builder(id);
20462
9011
ALTER TABLE ONLY distribution
20463
9012
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);
20466
9020
ALTER TABLE ONLY distribution
20467
9021
ADD CONSTRAINT "$3" FOREIGN KEY (bug_supervisor) REFERENCES person(id);
20470
9023
ALTER TABLE ONLY pofile
20471
9024
ADD CONSTRAINT "$3" FOREIGN KEY (from_sourcepackagename) REFERENCES sourcepackagename(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);
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);
20510
9032
ALTER TABLE ONLY accountpassword
20511
9033
ADD CONSTRAINT accountpassword_account_fkey FOREIGN KEY (account) REFERENCES account(id) ON DELETE CASCADE;
20514
9035
ALTER TABLE ONLY karma
20515
9036
ADD CONSTRAINT action_fkey FOREIGN KEY (action) REFERENCES karmaaction(id);
20518
9038
ALTER TABLE ONLY announcement
20519
9039
ADD CONSTRAINT announcement_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
20522
9041
ALTER TABLE ONLY announcement
20523
9042
ADD CONSTRAINT announcement_product_fkey FOREIGN KEY (product) REFERENCES product(id);
20526
9044
ALTER TABLE ONLY announcement
20527
9045
ADD CONSTRAINT announcement_project_fkey FOREIGN KEY (project) REFERENCES project(id);
20530
9047
ALTER TABLE ONLY announcement
20531
9048
ADD CONSTRAINT announcement_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
20534
9050
ALTER TABLE ONLY answercontact
20535
9051
ADD CONSTRAINT answercontact__distribution__fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
20538
9053
ALTER TABLE ONLY answercontact
20539
9054
ADD CONSTRAINT answercontact__person__fkey FOREIGN KEY (person) REFERENCES person(id);
20542
9056
ALTER TABLE ONLY answercontact
20543
9057
ADD CONSTRAINT answercontact__product__fkey FOREIGN KEY (product) REFERENCES product(id);
20546
9059
ALTER TABLE ONLY answercontact
20547
9060
ADD CONSTRAINT answercontact__sourcepackagename__fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
20550
9062
ALTER TABLE ONLY apportjob
20551
9063
ADD CONSTRAINT apportjob_blob_fkey FOREIGN KEY (blob) REFERENCES temporaryblobstorage(id);
20554
9065
ALTER TABLE ONLY apportjob
20555
9066
ADD CONSTRAINT apportjob_job_fkey FOREIGN KEY (job) REFERENCES job(id);
20558
9068
ALTER TABLE ONLY archive
20559
9069
ADD CONSTRAINT archive__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
20562
9071
ALTER TABLE ONLY archive
20563
9072
ADD CONSTRAINT archive__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
20566
9074
ALTER TABLE ONLY archive
20567
9075
ADD CONSTRAINT archive_signing_key_fkey FOREIGN KEY (signing_key) REFERENCES gpgkey(id);
20570
9077
ALTER TABLE ONLY archivearch
20571
9078
ADD CONSTRAINT archivearch__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
20574
9080
ALTER TABLE ONLY archivearch
20575
9081
ADD CONSTRAINT archivearch__processorfamily__fk FOREIGN KEY (processorfamily) REFERENCES processorfamily(id);
20578
9083
ALTER TABLE ONLY archiveauthtoken
20579
9084
ADD CONSTRAINT archiveauthtoken__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
20582
9086
ALTER TABLE ONLY archiveauthtoken
20583
9087
ADD CONSTRAINT archiveauthtoken_person_fkey FOREIGN KEY (person) REFERENCES person(id);
20586
9089
ALTER TABLE ONLY archivedependency
20587
9090
ADD CONSTRAINT archivedependency__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
20590
9092
ALTER TABLE ONLY archivedependency
20591
9093
ADD CONSTRAINT archivedependency__dependency__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
20594
9095
ALTER TABLE ONLY archivedependency
20595
9096
ADD CONSTRAINT archivedependency_component_fkey FOREIGN KEY (component) REFERENCES component(id);
20598
9098
ALTER TABLE ONLY archivejob
20599
9099
ADD CONSTRAINT archivejob__archive__fk FOREIGN KEY (archive) REFERENCES archive(id);
20602
9101
ALTER TABLE ONLY archivejob
20603
9102
ADD CONSTRAINT archivejob__job__fk FOREIGN KEY (job) REFERENCES job(id) ON DELETE CASCADE;
20606
9104
ALTER TABLE ONLY archivepermission
20607
9105
ADD CONSTRAINT archivepermission__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
20610
9107
ALTER TABLE ONLY archivepermission
20611
9108
ADD CONSTRAINT archivepermission__component__fk FOREIGN KEY (component) REFERENCES component(id);
20614
9110
ALTER TABLE ONLY archivepermission
20615
9111
ADD CONSTRAINT archivepermission__packageset__fk FOREIGN KEY (packageset) REFERENCES packageset(id);
20618
9113
ALTER TABLE ONLY archivepermission
20619
9114
ADD CONSTRAINT archivepermission__person__fk FOREIGN KEY (person) REFERENCES person(id);
20622
9116
ALTER TABLE ONLY archivepermission
20623
9117
ADD CONSTRAINT archivepermission__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
20626
9119
ALTER TABLE ONLY archivesubscriber
20627
9120
ADD CONSTRAINT archivesubscriber__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
20630
9122
ALTER TABLE ONLY archivesubscriber
20631
9123
ADD CONSTRAINT archivesubscriber_cancelled_by_fkey FOREIGN KEY (cancelled_by) REFERENCES person(id);
20634
9125
ALTER TABLE ONLY archivesubscriber
20635
9126
ADD CONSTRAINT archivesubscriber_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
20638
9128
ALTER TABLE ONLY archivesubscriber
20639
9129
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);
20642
9134
ALTER TABLE ONLY binarypackagebuild
20643
9135
ADD CONSTRAINT binarypackagebuild__distro_arch_series__fk FOREIGN KEY (distro_arch_series) REFERENCES distroarchseries(id);
20646
9137
ALTER TABLE ONLY binarypackagebuild
20647
9138
ADD CONSTRAINT binarypackagebuild__package_build__fk FOREIGN KEY (package_build) REFERENCES packagebuild(id);
20650
9140
ALTER TABLE ONLY binarypackagebuild
20651
9141
ADD CONSTRAINT binarypackagebuild__source_package_release__fk FOREIGN KEY (source_package_release) REFERENCES sourcepackagerelease(id);
20654
9143
ALTER TABLE ONLY binarypackagefile
20655
9144
ADD CONSTRAINT binarypackagefile_binarypackagerelease_fk FOREIGN KEY (binarypackagerelease) REFERENCES binarypackagerelease(id) ON DELETE CASCADE;
20658
9146
ALTER TABLE ONLY binarypackagefile
20659
9147
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);
20666
9149
ALTER TABLE ONLY binarypackagepublishinghistory
20667
9150
ADD CONSTRAINT binarypackagepublishinghistory_supersededby_fk FOREIGN KEY (supersededby) REFERENCES binarypackagebuild(id);
20670
9152
ALTER TABLE ONLY binarypackagerelease
20671
9153
ADD CONSTRAINT binarypackagerelease_binarypackagename_fk FOREIGN KEY (binarypackagename) REFERENCES binarypackagename(id);
20674
9155
ALTER TABLE ONLY binarypackagerelease
20675
9156
ADD CONSTRAINT binarypackagerelease_build_fk FOREIGN KEY (build) REFERENCES binarypackagebuild(id) ON DELETE CASCADE;
20678
9158
ALTER TABLE ONLY binarypackagerelease
20679
9159
ADD CONSTRAINT binarypackagerelease_component_fk FOREIGN KEY (component) REFERENCES component(id);
20682
9161
ALTER TABLE ONLY binarypackagerelease
20683
9162
ADD CONSTRAINT binarypackagerelease_debug_package_fkey FOREIGN KEY (debug_package) REFERENCES binarypackagerelease(id);
20686
9164
ALTER TABLE ONLY binarypackagerelease
20687
9165
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);
20698
9167
ALTER TABLE ONLY binarypackagereleasedownloadcount
20699
9168
ADD CONSTRAINT binarypackagereleasedownloadcount_archive_fkey FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
20702
9170
ALTER TABLE ONLY binarypackagereleasedownloadcount
20703
9171
ADD CONSTRAINT binarypackagereleasedownloadcount_binary_package_release_fkey FOREIGN KEY (binary_package_release) REFERENCES binarypackagerelease(id);
20706
9173
ALTER TABLE ONLY binarypackagereleasedownloadcount
20707
9174
ADD CONSTRAINT binarypackagereleasedownloadcount_country_fkey FOREIGN KEY (country) REFERENCES country(id);
20710
ALTER TABLE ONLY branch
20711
ADD CONSTRAINT branch_access_policy_fkey FOREIGN KEY (access_policy) REFERENCES accesspolicy(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);
20714
9197
ALTER TABLE ONLY branch
20715
9198
ADD CONSTRAINT branch_author_fk FOREIGN KEY (author) REFERENCES person(id);
20718
9200
ALTER TABLE ONLY branch
20719
9201
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;
20726
9203
ALTER TABLE ONLY branch
20727
ADD CONSTRAINT branch_merge_queue_fkey FOREIGN KEY (merge_queue) REFERENCES branchmergequeue(id);
9204
ADD CONSTRAINT branch_merge_robot_fkey FOREIGN KEY (merge_robot) REFERENCES branchmergerobot(id);
20730
9206
ALTER TABLE ONLY branch
20731
9207
ADD CONSTRAINT branch_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
20734
9209
ALTER TABLE ONLY branch
20735
9210
ADD CONSTRAINT branch_product_fk FOREIGN KEY (product) REFERENCES product(id);
20738
9212
ALTER TABLE ONLY branch
20739
9213
ADD CONSTRAINT branch_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
20742
9215
ALTER TABLE ONLY branch
20743
9216
ADD CONSTRAINT branch_reviewer_fkey FOREIGN KEY (reviewer) REFERENCES person(id);
20746
9218
ALTER TABLE ONLY branch
20747
9219
ADD CONSTRAINT branch_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
20750
9221
ALTER TABLE ONLY branch
20751
9222
ADD CONSTRAINT branch_stacked_on_fkey FOREIGN KEY (stacked_on) REFERENCES branch(id);
20754
9224
ALTER TABLE ONLY branchjob
20755
9225
ADD CONSTRAINT branchjob_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
20758
9227
ALTER TABLE ONLY branchjob
20759
9228
ADD CONSTRAINT branchjob_job_fkey FOREIGN KEY (job) REFERENCES job(id) ON DELETE CASCADE;
20762
9230
ALTER TABLE ONLY branchmergeproposal
20763
9231
ADD CONSTRAINT branchmergeproposal_dependent_branch_fkey FOREIGN KEY (dependent_branch) REFERENCES branch(id);
20766
9233
ALTER TABLE ONLY branchmergeproposal
20767
9234
ADD CONSTRAINT branchmergeproposal_merge_diff_fkey FOREIGN KEY (merge_diff) REFERENCES previewdiff(id);
20770
9236
ALTER TABLE ONLY branchmergeproposal
20771
9237
ADD CONSTRAINT branchmergeproposal_merge_log_file_fkey FOREIGN KEY (merge_log_file) REFERENCES libraryfilealias(id);
20774
9239
ALTER TABLE ONLY branchmergeproposal
20775
9240
ADD CONSTRAINT branchmergeproposal_merge_reporter_fkey FOREIGN KEY (merge_reporter) REFERENCES person(id);
20778
9242
ALTER TABLE ONLY branchmergeproposal
20779
9243
ADD CONSTRAINT branchmergeproposal_merger_fkey FOREIGN KEY (merger) REFERENCES person(id);
20782
9245
ALTER TABLE ONLY branchmergeproposal
20783
9246
ADD CONSTRAINT branchmergeproposal_queuer_fkey FOREIGN KEY (queuer) REFERENCES person(id);
20786
9248
ALTER TABLE ONLY branchmergeproposal
20787
9249
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);
20790
9254
ALTER TABLE ONLY branchmergeproposal
20791
9255
ADD CONSTRAINT branchmergeproposal_reviewer_fkey FOREIGN KEY (reviewer) REFERENCES person(id);
20794
9257
ALTER TABLE ONLY branchmergeproposal
20795
9258
ADD CONSTRAINT branchmergeproposal_source_branch_fkey FOREIGN KEY (source_branch) REFERENCES branch(id);
20798
9260
ALTER TABLE ONLY branchmergeproposal
20799
9261
ADD CONSTRAINT branchmergeproposal_superseded_by_fkey FOREIGN KEY (superseded_by) REFERENCES branchmergeproposal(id);
20802
9263
ALTER TABLE ONLY branchmergeproposal
20803
9264
ADD CONSTRAINT branchmergeproposal_target_branch_fkey FOREIGN KEY (target_branch) REFERENCES branch(id);
20806
9266
ALTER TABLE ONLY branchmergeproposaljob
20807
9267
ADD CONSTRAINT branchmergeproposaljob_branch_merge_proposal_fkey FOREIGN KEY (branch_merge_proposal) REFERENCES branchmergeproposal(id);
20810
9269
ALTER TABLE ONLY branchmergeproposaljob
20811
9270
ADD CONSTRAINT branchmergeproposaljob_job_fkey FOREIGN KEY (job) REFERENCES job(id) ON DELETE CASCADE;
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);
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);
20822
9278
ALTER TABLE ONLY branchrevision
20823
9279
ADD CONSTRAINT branchrevision__branch__fk FOREIGN KEY (branch) REFERENCES branch(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
20826
9281
ALTER TABLE ONLY branchrevision
20827
9282
ADD CONSTRAINT branchrevision__revision__fk FOREIGN KEY (revision) REFERENCES revision(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
20830
9284
ALTER TABLE ONLY branchsubscription
20831
9285
ADD CONSTRAINT branchsubscription_branch_fk FOREIGN KEY (branch) REFERENCES branch(id);
20834
9287
ALTER TABLE ONLY branchsubscription
20835
9288
ADD CONSTRAINT branchsubscription_person_fk FOREIGN KEY (person) REFERENCES person(id);
20838
9290
ALTER TABLE ONLY branchsubscription
20839
9291
ADD CONSTRAINT branchsubscription_subscribed_by_fkey FOREIGN KEY (subscribed_by) REFERENCES person(id);
20842
9293
ALTER TABLE ONLY branchvisibilitypolicy
20843
9294
ADD CONSTRAINT branchvisibilitypolicy_product_fkey FOREIGN KEY (product) REFERENCES product(id);
20846
9296
ALTER TABLE ONLY branchvisibilitypolicy
20847
9297
ADD CONSTRAINT branchvisibilitypolicy_project_fkey FOREIGN KEY (project) REFERENCES project(id);
20850
9299
ALTER TABLE ONLY branchvisibilitypolicy
20851
9300
ADD CONSTRAINT branchvisibilitypolicy_team_fkey FOREIGN KEY (team) REFERENCES person(id);
20854
9302
ALTER TABLE ONLY bug
20855
9303
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);
20862
9305
ALTER TABLE ONLY bug
20863
9306
ADD CONSTRAINT bug_duplicateof_fk FOREIGN KEY (duplicateof) REFERENCES bug(id);
20866
9308
ALTER TABLE ONLY bug
20867
9309
ADD CONSTRAINT bug_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
20870
9311
ALTER TABLE ONLY bugactivity
20871
9312
ADD CONSTRAINT bugactivity__person__fk FOREIGN KEY (person) REFERENCES person(id);
20874
9314
ALTER TABLE ONLY bugaffectsperson
20875
9315
ADD CONSTRAINT bugaffectsperson_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
20878
9317
ALTER TABLE ONLY bugaffectsperson
20879
9318
ADD CONSTRAINT bugaffectsperson_person_fkey FOREIGN KEY (person) REFERENCES person(id);
20882
9320
ALTER TABLE ONLY bugattachment
20883
9321
ADD CONSTRAINT bugattachment_bug_fk FOREIGN KEY (bug) REFERENCES bug(id);
20886
9323
ALTER TABLE ONLY bugattachment
20887
9324
ADD CONSTRAINT bugattachment_libraryfile_fk FOREIGN KEY (libraryfile) REFERENCES libraryfilealias(id);
20890
9326
ALTER TABLE ONLY bugattachment
20891
9327
ADD CONSTRAINT bugattachment_message_fk FOREIGN KEY (message) REFERENCES message(id);
20894
9329
ALTER TABLE ONLY bugbranch
20895
9330
ADD CONSTRAINT bugbranch_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
20898
9332
ALTER TABLE ONLY bugbranch
20899
9333
ADD CONSTRAINT bugbranch_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
20902
9335
ALTER TABLE ONLY bugbranch
20903
9336
ADD CONSTRAINT bugbranch_fixed_in_revision_fkey FOREIGN KEY (revision_hint) REFERENCES revision(id);
20906
9338
ALTER TABLE ONLY bugbranch
20907
9339
ADD CONSTRAINT bugbranch_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
20910
9341
ALTER TABLE ONLY bugcve
20911
9342
ADD CONSTRAINT bugcve_bug_fk FOREIGN KEY (bug) REFERENCES bug(id);
20914
9344
ALTER TABLE ONLY bugcve
20915
9345
ADD CONSTRAINT bugcve_cve_fk FOREIGN KEY (cve) REFERENCES cve(id);
20918
9347
ALTER TABLE ONLY bugjob
20919
9348
ADD CONSTRAINT bugjob_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
20922
9350
ALTER TABLE ONLY bugjob
20923
9351
ADD CONSTRAINT bugjob_job_fkey FOREIGN KEY (job) REFERENCES job(id);
20926
9353
ALTER TABLE ONLY bugmessage
20927
9354
ADD CONSTRAINT bugmessage__bug__fk FOREIGN KEY (bug) REFERENCES bug(id);
20930
9356
ALTER TABLE ONLY bugmessage
20931
9357
ADD CONSTRAINT bugmessage_bugwatch_fkey FOREIGN KEY (bugwatch) REFERENCES bugwatch(id);
20934
9359
ALTER TABLE ONLY bugmessage
20935
9360
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;
20946
9362
ALTER TABLE ONLY bugnomination
20947
9363
ADD CONSTRAINT bugnomination__bug__fk FOREIGN KEY (bug) REFERENCES bug(id);
20950
9365
ALTER TABLE ONLY bugnomination
20951
9366
ADD CONSTRAINT bugnomination__decider__fk FOREIGN KEY (decider) REFERENCES person(id);
20954
9368
ALTER TABLE ONLY bugnomination
20955
9369
ADD CONSTRAINT bugnomination__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
20958
9371
ALTER TABLE ONLY bugnomination
20959
9372
ADD CONSTRAINT bugnomination__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
20962
9374
ALTER TABLE ONLY bugnomination
20963
9375
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);
20970
9377
ALTER TABLE ONLY bugnotification
20971
9378
ADD CONSTRAINT bugnotification_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
20974
9380
ALTER TABLE ONLY bugnotification
20975
9381
ADD CONSTRAINT bugnotification_message_fkey FOREIGN KEY (message) REFERENCES message(id);
20978
9383
ALTER TABLE ONLY bugnotificationarchive
20979
9384
ADD CONSTRAINT bugnotificationarchive__bug__fk FOREIGN KEY (bug) REFERENCES bug(id);
20982
9386
ALTER TABLE ONLY bugnotificationarchive
20983
9387
ADD CONSTRAINT bugnotificationarchive__message__fk FOREIGN KEY (message) REFERENCES message(id);
20986
9389
ALTER TABLE ONLY bugnotificationattachment
20987
9390
ADD CONSTRAINT bugnotificationattachment__bug_notification__fk FOREIGN KEY (bug_notification) REFERENCES bugnotification(id) ON DELETE CASCADE;
20990
9392
ALTER TABLE ONLY bugnotificationattachment
20991
9393
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;
21002
9395
ALTER TABLE ONLY bugnotificationrecipient
21003
9396
ADD CONSTRAINT bugnotificationrecipient__bug_notification__fk FOREIGN KEY (bug_notification) REFERENCES bugnotification(id) ON DELETE CASCADE;
21006
9398
ALTER TABLE ONLY bugnotificationrecipient
21007
9399
ADD CONSTRAINT bugnotificationrecipient_person_fkey FOREIGN KEY (person) REFERENCES person(id);
21010
9401
ALTER TABLE ONLY bugnotificationrecipientarchive
21011
9402
ADD CONSTRAINT bugnotificationrecipientarchive__bug_notification__fk FOREIGN KEY (bug_notification) REFERENCES bugnotificationarchive(id);
21014
9404
ALTER TABLE ONLY bugnotificationrecipientarchive
21015
9405
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);
21018
9437
ALTER TABLE ONLY bugsubscription
21019
9438
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;
21098
9440
ALTER TABLE ONLY bugtask
21099
9441
ADD CONSTRAINT bugtask__assignee__fk FOREIGN KEY (assignee) REFERENCES person(id);
21102
9443
ALTER TABLE ONLY bugtask
21103
9444
ADD CONSTRAINT bugtask__binarypackagename__fk FOREIGN KEY (binarypackagename) REFERENCES binarypackagename(id);
21106
9446
ALTER TABLE ONLY bugtask
21107
9447
ADD CONSTRAINT bugtask__bug__fk FOREIGN KEY (bug) REFERENCES bug(id);
21110
9449
ALTER TABLE ONLY bugtask
21111
9450
ADD CONSTRAINT bugtask__bugwatch__fk FOREIGN KEY (bugwatch) REFERENCES bugwatch(id);
21114
9452
ALTER TABLE ONLY bugtask
21115
9453
ADD CONSTRAINT bugtask__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
21118
9455
ALTER TABLE ONLY bugtask
21119
9456
ADD CONSTRAINT bugtask__distribution__milestone__fk FOREIGN KEY (distribution, milestone) REFERENCES milestone(distribution, id);
21122
9458
ALTER TABLE ONLY bugtask
21123
9459
ADD CONSTRAINT bugtask__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21126
9461
ALTER TABLE ONLY bugtask
21127
9462
ADD CONSTRAINT bugtask__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
21130
9464
ALTER TABLE ONLY bugtask
21131
9465
ADD CONSTRAINT bugtask__product__fk FOREIGN KEY (product) REFERENCES product(id);
21134
9467
ALTER TABLE ONLY bugtask
21135
9468
ADD CONSTRAINT bugtask__product__milestone__fk FOREIGN KEY (product, milestone) REFERENCES milestone(product, id);
21138
9470
ALTER TABLE ONLY bugtask
21139
9471
ADD CONSTRAINT bugtask__productseries__fk FOREIGN KEY (productseries) REFERENCES productseries(id);
21142
9473
ALTER TABLE ONLY bugtask
21143
9474
ADD CONSTRAINT bugtask__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
21146
9476
ALTER TABLE ONLY bugtracker
21147
9477
ADD CONSTRAINT bugtracker_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
21150
9479
ALTER TABLE ONLY bugtrackeralias
21151
9480
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);
21170
9482
ALTER TABLE ONLY bugtrackerperson
21171
9483
ADD CONSTRAINT bugtrackerperson_bugtracker_fkey FOREIGN KEY (bugtracker) REFERENCES bugtracker(id);
21174
9485
ALTER TABLE ONLY bugtrackerperson
21175
9486
ADD CONSTRAINT bugtrackerperson_person_fkey FOREIGN KEY (person) REFERENCES person(id);
21178
9488
ALTER TABLE ONLY bugwatch
21179
9489
ADD CONSTRAINT bugwatch_bug_fk FOREIGN KEY (bug) REFERENCES bug(id);
21182
9491
ALTER TABLE ONLY bugwatch
21183
9492
ADD CONSTRAINT bugwatch_bugtracker_fk FOREIGN KEY (bugtracker) REFERENCES bugtracker(id);
21186
9494
ALTER TABLE ONLY bugwatch
21187
9495
ADD CONSTRAINT bugwatch_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
21190
9497
ALTER TABLE ONLY bugwatchactivity
21191
9498
ADD CONSTRAINT bugwatchactivity_bug_watch_fkey FOREIGN KEY (bug_watch) REFERENCES bugwatch(id);
21194
9500
ALTER TABLE ONLY buildfarmjob
21195
9501
ADD CONSTRAINT buildfarmjob__builder__fk FOREIGN KEY (builder) REFERENCES builder(id);
21198
9503
ALTER TABLE ONLY buildfarmjob
21199
9504
ADD CONSTRAINT buildfarmjob__log__fk FOREIGN KEY (log) REFERENCES libraryfilealias(id);
21202
9506
ALTER TABLE ONLY buildfarmjob
21203
9507
ADD CONSTRAINT buildfarmjob__processor__fk FOREIGN KEY (processor) REFERENCES processor(id);
21206
9509
ALTER TABLE ONLY buildpackagejob
21207
9510
ADD CONSTRAINT buildpackagejob__job__fk FOREIGN KEY (job) REFERENCES job(id);
21210
9512
ALTER TABLE ONLY buildpackagejob
21211
9513
ADD CONSTRAINT buildpackagejob_build_fk FOREIGN KEY (build) REFERENCES binarypackagebuild(id);
21214
9515
ALTER TABLE ONLY buildqueue
21215
9516
ADD CONSTRAINT buildqueue__job__fk FOREIGN KEY (job) REFERENCES job(id);
21218
9518
ALTER TABLE ONLY buildqueue
21219
9519
ADD CONSTRAINT buildqueue__processor__fk FOREIGN KEY (processor) REFERENCES processor(id);
21222
9521
ALTER TABLE ONLY codeimport
21223
9522
ADD CONSTRAINT codeimport_assignee_fkey FOREIGN KEY (assignee) REFERENCES person(id);
21226
9524
ALTER TABLE ONLY codeimport
21227
9525
ADD CONSTRAINT codeimport_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
21230
9527
ALTER TABLE ONLY codeimport
21231
9528
ADD CONSTRAINT codeimport_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
21234
9530
ALTER TABLE ONLY codeimport
21235
9531
ADD CONSTRAINT codeimport_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
21238
9533
ALTER TABLE ONLY codeimportevent
21239
9534
ADD CONSTRAINT codeimportevent__code_import__fk FOREIGN KEY (code_import) REFERENCES codeimport(id) ON DELETE CASCADE;
21242
9536
ALTER TABLE ONLY codeimportevent
21243
9537
ADD CONSTRAINT codeimportevent__machine__fk FOREIGN KEY (machine) REFERENCES codeimportmachine(id);
21246
9539
ALTER TABLE ONLY codeimportevent
21247
9540
ADD CONSTRAINT codeimportevent__person__fk FOREIGN KEY (person) REFERENCES person(id);
21250
9542
ALTER TABLE ONLY codeimporteventdata
21251
9543
ADD CONSTRAINT codeimporteventdata__event__fk FOREIGN KEY (event) REFERENCES codeimportevent(id) ON DELETE CASCADE;
21254
9545
ALTER TABLE ONLY codeimportjob
21255
9546
ADD CONSTRAINT codeimportjob__code_import__fk FOREIGN KEY (code_import) REFERENCES codeimport(id);
21258
9548
ALTER TABLE ONLY codeimportjob
21259
9549
ADD CONSTRAINT codeimportjob__machine__fk FOREIGN KEY (machine) REFERENCES codeimportmachine(id);
21262
9551
ALTER TABLE ONLY codeimportjob
21263
9552
ADD CONSTRAINT codeimportjob__requesting_user__fk FOREIGN KEY (requesting_user) REFERENCES person(id);
21266
9554
ALTER TABLE ONLY codeimportresult
21267
9555
ADD CONSTRAINT codeimportresult__code_import__fk FOREIGN KEY (code_import) REFERENCES codeimport(id) ON DELETE CASCADE;
21270
9557
ALTER TABLE ONLY codeimportresult
21271
9558
ADD CONSTRAINT codeimportresult__log_file__fk FOREIGN KEY (log_file) REFERENCES libraryfilealias(id);
21274
9560
ALTER TABLE ONLY codeimportresult
21275
9561
ADD CONSTRAINT codeimportresult__machine__fk FOREIGN KEY (machine) REFERENCES codeimportmachine(id);
21278
9563
ALTER TABLE ONLY codeimportresult
21279
9564
ADD CONSTRAINT codeimportresult__requesting_user__fk FOREIGN KEY (requesting_user) REFERENCES person(id);
21282
9566
ALTER TABLE ONLY codereviewmessage
21283
9567
ADD CONSTRAINT codereviewmessage_branch_merge_proposal_fkey FOREIGN KEY (branch_merge_proposal) REFERENCES branchmergeproposal(id);
21286
9569
ALTER TABLE ONLY codereviewmessage
21287
9570
ADD CONSTRAINT codereviewmessage_message_fkey FOREIGN KEY (message) REFERENCES message(id);
21290
9572
ALTER TABLE ONLY codereviewvote
21291
9573
ADD CONSTRAINT codereviewvote_branch_merge_proposal_fkey FOREIGN KEY (branch_merge_proposal) REFERENCES branchmergeproposal(id);
21294
9575
ALTER TABLE ONLY codereviewvote
21295
9576
ADD CONSTRAINT codereviewvote_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
21298
9578
ALTER TABLE ONLY codereviewvote
21299
9579
ADD CONSTRAINT codereviewvote_reviewer_fkey FOREIGN KEY (reviewer) REFERENCES person(id);
21302
9581
ALTER TABLE ONLY codereviewvote
21303
9582
ADD CONSTRAINT codereviewvote_vote_message_fkey FOREIGN KEY (vote_message) REFERENCES codereviewmessage(id);
21306
9584
ALTER TABLE ONLY commercialsubscription
21307
9585
ADD CONSTRAINT commercialsubscription__product__fk FOREIGN KEY (product) REFERENCES product(id);
21310
9587
ALTER TABLE ONLY commercialsubscription
21311
9588
ADD CONSTRAINT commercialsubscription__purchaser__fk FOREIGN KEY (purchaser) REFERENCES person(id);
21314
9590
ALTER TABLE ONLY commercialsubscription
21315
9591
ADD CONSTRAINT commercialsubscription__registrant__fk FOREIGN KEY (registrant) REFERENCES person(id);
21318
9593
ALTER TABLE ONLY componentselection
21319
9594
ADD CONSTRAINT componentselection__component__fk FOREIGN KEY (component) REFERENCES component(id);
21322
9596
ALTER TABLE ONLY componentselection
21323
9597
ADD CONSTRAINT componentselection__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21326
9599
ALTER TABLE ONLY customlanguagecode
21327
9600
ADD CONSTRAINT customlanguagecode_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
21330
9602
ALTER TABLE ONLY customlanguagecode
21331
9603
ADD CONSTRAINT customlanguagecode_language_fkey FOREIGN KEY (language) REFERENCES language(id);
21334
9605
ALTER TABLE ONLY customlanguagecode
21335
9606
ADD CONSTRAINT customlanguagecode_product_fkey FOREIGN KEY (product) REFERENCES product(id);
21338
9608
ALTER TABLE ONLY customlanguagecode
21339
9609
ADD CONSTRAINT customlanguagecode_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
21342
9611
ALTER TABLE ONLY cvereference
21343
9612
ADD CONSTRAINT cvereference_cve_fk FOREIGN KEY (cve) REFERENCES cve(id);
21346
9614
ALTER TABLE ONLY diff
21347
9615
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;
21354
9617
ALTER TABLE ONLY distribution
21355
9618
ADD CONSTRAINT distribution__icon__fk FOREIGN KEY (icon) REFERENCES libraryfilealias(id);
21358
9620
ALTER TABLE ONLY distribution
21359
9621
ADD CONSTRAINT distribution__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
21362
9623
ALTER TABLE ONLY distribution
21363
9624
ADD CONSTRAINT distribution__mugshot__fk FOREIGN KEY (mugshot) REFERENCES libraryfilealias(id);
21366
9626
ALTER TABLE ONLY distribution
21367
9627
ADD CONSTRAINT distribution_driver_fk FOREIGN KEY (driver) REFERENCES person(id);
21370
9629
ALTER TABLE ONLY distribution
21371
9630
ADD CONSTRAINT distribution_language_pack_admin_fkey FOREIGN KEY (language_pack_admin) REFERENCES person(id);
21374
9632
ALTER TABLE ONLY distribution
21375
9633
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);
21382
9635
ALTER TABLE ONLY distribution
21383
9636
ADD CONSTRAINT distribution_security_contact_fkey FOREIGN KEY (security_contact) REFERENCES person(id);
21386
9638
ALTER TABLE ONLY distribution
21387
9639
ADD CONSTRAINT distribution_translation_focus_fkey FOREIGN KEY (translation_focus) REFERENCES distroseries(id);
21390
9641
ALTER TABLE ONLY distribution
21391
9642
ADD CONSTRAINT distribution_translationgroup_fk FOREIGN KEY (translationgroup) REFERENCES translationgroup(id);
21394
9644
ALTER TABLE ONLY distribution
21395
9645
ADD CONSTRAINT distribution_upload_admin_fk FOREIGN KEY (upload_admin) REFERENCES person(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);
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);
21410
9653
ALTER TABLE ONLY distributionmirror
21411
9654
ADD CONSTRAINT distributionmirror_country_fkey FOREIGN KEY (country) REFERENCES country(id);
21414
9656
ALTER TABLE ONLY distributionmirror
21415
9657
ADD CONSTRAINT distributionmirror_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
21418
9659
ALTER TABLE ONLY distributionmirror
21419
9660
ADD CONSTRAINT distributionmirror_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
21422
9662
ALTER TABLE ONLY distributionmirror
21423
9663
ADD CONSTRAINT distributionmirror_reviewer_fkey FOREIGN KEY (reviewer) REFERENCES person(id);
21426
9665
ALTER TABLE ONLY distributionsourcepackage
21427
9666
ADD CONSTRAINT distributionpackage__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
21430
9668
ALTER TABLE ONLY distributionsourcepackage
21431
9669
ADD CONSTRAINT distributionpackage__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
21434
9671
ALTER TABLE ONLY distributionsourcepackagecache
21435
9672
ADD CONSTRAINT distributionsourcepackagecache__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
21438
9674
ALTER TABLE ONLY distributionsourcepackagecache
21439
9675
ADD CONSTRAINT distributionsourcepackagecache_distribution_fk FOREIGN KEY (distribution) REFERENCES distribution(id);
21442
9677
ALTER TABLE ONLY distributionsourcepackagecache
21443
9678
ADD CONSTRAINT distributionsourcepackagecache_sourcepackagename_fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
21446
9680
ALTER TABLE ONLY distroarchseries
21447
9681
ADD CONSTRAINT distroarchseries__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21450
9683
ALTER TABLE ONLY distroarchseries
21451
9684
ADD CONSTRAINT distroarchseries__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
21454
9686
ALTER TABLE ONLY distroarchseries
21455
9687
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);
21458
9698
ALTER TABLE ONLY distroseries
21459
9699
ADD CONSTRAINT distrorelease_parentrelease_fk FOREIGN KEY (parent_series) REFERENCES distroseries(id);
21462
9701
ALTER TABLE ONLY distroserieslanguage
21463
9702
ADD CONSTRAINT distroreleaselanguage_language_fk FOREIGN KEY (language) REFERENCES language(id);
21466
9704
ALTER TABLE ONLY distroseries
21467
9705
ADD CONSTRAINT distroseries__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
21470
9707
ALTER TABLE ONLY distroseries
21471
9708
ADD CONSTRAINT distroseries__driver__fk FOREIGN KEY (driver) REFERENCES person(id);
21474
9710
ALTER TABLE ONLY distroseries
21475
9711
ADD CONSTRAINT distroseries__language_pack_base__fk FOREIGN KEY (language_pack_base) REFERENCES languagepack(id);
21478
9713
ALTER TABLE ONLY distroseries
21479
9714
ADD CONSTRAINT distroseries__language_pack_delta__fk FOREIGN KEY (language_pack_delta) REFERENCES languagepack(id);
21482
9716
ALTER TABLE ONLY distroseries
21483
9717
ADD CONSTRAINT distroseries__language_pack_proposed__fk FOREIGN KEY (language_pack_proposed) REFERENCES languagepack(id);
21486
9719
ALTER TABLE ONLY distroseries
21487
9720
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);
21490
9725
ALTER TABLE ONLY distroseries
21491
9726
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);
21530
9728
ALTER TABLE ONLY distroserieslanguage
21531
9729
ADD CONSTRAINT distroserieslanguage__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21534
9731
ALTER TABLE ONLY distroserieslanguage
21535
9732
ADD CONSTRAINT distroserieslanguage__language__fk FOREIGN KEY (language) REFERENCES language(id);
21538
9734
ALTER TABLE ONLY distroseriespackagecache
21539
9735
ADD CONSTRAINT distroseriespackagecache__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
21542
9737
ALTER TABLE ONLY distroseriespackagecache
21543
9738
ADD CONSTRAINT distroseriespackagecache__binarypackagename__fk FOREIGN KEY (binarypackagename) REFERENCES binarypackagename(id);
21546
9740
ALTER TABLE ONLY distroseriespackagecache
21547
9741
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);
21562
9743
ALTER TABLE ONLY emailaddress
21563
9744
ADD CONSTRAINT emailaddress__account__fk FOREIGN KEY (account) REFERENCES account(id) ON DELETE SET NULL;
21566
9746
ALTER TABLE ONLY emailaddress
21567
9747
ADD CONSTRAINT emailaddress__person__fk FOREIGN KEY (person) REFERENCES person(id);
21570
9749
ALTER TABLE ONLY entitlement
21571
9750
ADD CONSTRAINT entitlement_approved_by_fkey FOREIGN KEY (approved_by) REFERENCES person(id);
21574
9752
ALTER TABLE ONLY entitlement
21575
9753
ADD CONSTRAINT entitlement_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
21578
9755
ALTER TABLE ONLY entitlement
21579
9756
ADD CONSTRAINT entitlement_person_fkey FOREIGN KEY (person) REFERENCES person(id);
21582
9758
ALTER TABLE ONLY entitlement
21583
9759
ADD CONSTRAINT entitlement_product_fkey FOREIGN KEY (product) REFERENCES product(id);
21586
9761
ALTER TABLE ONLY entitlement
21587
9762
ADD CONSTRAINT entitlement_project_fkey FOREIGN KEY (project) REFERENCES project(id);
21590
9764
ALTER TABLE ONLY entitlement
21591
9765
ADD CONSTRAINT entitlement_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
21594
9767
ALTER TABLE ONLY faq
21595
9768
ADD CONSTRAINT faq_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
21598
9770
ALTER TABLE ONLY faq
21599
9771
ADD CONSTRAINT faq_last_updated_by_fkey FOREIGN KEY (last_updated_by) REFERENCES person(id);
21602
9773
ALTER TABLE ONLY faq
21603
9774
ADD CONSTRAINT faq_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
21606
9776
ALTER TABLE ONLY faq
21607
9777
ADD CONSTRAINT faq_product_fkey FOREIGN KEY (product) REFERENCES product(id);
21610
9779
ALTER TABLE ONLY featuredproject
21611
9780
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);
21618
9782
ALTER TABLE ONLY flatpackagesetinclusion
21619
9783
ADD CONSTRAINT flatpackagesetinclusion__child__fk FOREIGN KEY (child) REFERENCES packageset(id);
21622
9785
ALTER TABLE ONLY flatpackagesetinclusion
21623
9786
ADD CONSTRAINT flatpackagesetinclusion__parent__fk FOREIGN KEY (parent) REFERENCES packageset(id);
21626
9788
ALTER TABLE ONLY gpgkey
21627
9789
ADD CONSTRAINT gpgkey_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
21630
9791
ALTER TABLE ONLY hwdevice
21631
9792
ADD CONSTRAINT hwdevice_bus_vendor_id_fkey FOREIGN KEY (bus_vendor_id) REFERENCES hwvendorid(id);
21634
9794
ALTER TABLE ONLY hwdeviceclass
21635
9795
ADD CONSTRAINT hwdeviceclass_device_fkey FOREIGN KEY (device) REFERENCES hwdevice(id);
21638
9797
ALTER TABLE ONLY hwdevicedriverlink
21639
9798
ADD CONSTRAINT hwdevicedriverlink_device_fkey FOREIGN KEY (device) REFERENCES hwdevice(id);
21642
9800
ALTER TABLE ONLY hwdevicedriverlink
21643
9801
ADD CONSTRAINT hwdevicedriverlink_driver_fkey FOREIGN KEY (driver) REFERENCES hwdriver(id);
21646
9803
ALTER TABLE ONLY hwdevicenamevariant
21647
9804
ADD CONSTRAINT hwdevicenamevariant_device_fkey FOREIGN KEY (device) REFERENCES hwdevice(id);
21650
9806
ALTER TABLE ONLY hwdevicenamevariant
21651
9807
ADD CONSTRAINT hwdevicenamevariant_vendor_name_fkey FOREIGN KEY (vendor_name) REFERENCES hwvendorname(id);
21654
9809
ALTER TABLE ONLY hwdmihandle
21655
9810
ADD CONSTRAINT hwdmihandle_submission_fkey FOREIGN KEY (submission) REFERENCES hwsubmission(id);
21658
9812
ALTER TABLE ONLY hwdmivalue
21659
9813
ADD CONSTRAINT hwdmivalue_handle_fkey FOREIGN KEY (handle) REFERENCES hwdmihandle(id);
21662
9815
ALTER TABLE ONLY hwsubmission
21663
9816
ADD CONSTRAINT hwsubmission__distroarchseries__fk FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
21666
9818
ALTER TABLE ONLY hwsubmission
21667
9819
ADD CONSTRAINT hwsubmission__owned__fk FOREIGN KEY (owner) REFERENCES person(id);
21670
9821
ALTER TABLE ONLY hwsubmission
21671
9822
ADD CONSTRAINT hwsubmission__raw_submission__fk FOREIGN KEY (raw_submission) REFERENCES libraryfilealias(id);
21674
9824
ALTER TABLE ONLY hwsubmission
21675
9825
ADD CONSTRAINT hwsubmission__system_fingerprint__fk FOREIGN KEY (system_fingerprint) REFERENCES hwsystemfingerprint(id);
21678
9827
ALTER TABLE ONLY hwsubmissionbug
21679
9828
ADD CONSTRAINT hwsubmissionbug_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
21682
9830
ALTER TABLE ONLY hwsubmissionbug
21683
9831
ADD CONSTRAINT hwsubmissionbug_submission_fkey FOREIGN KEY (submission) REFERENCES hwsubmission(id);
21686
9833
ALTER TABLE ONLY hwsubmissiondevice
21687
9834
ADD CONSTRAINT hwsubmissiondevice_device_driver_link_fkey FOREIGN KEY (device_driver_link) REFERENCES hwdevicedriverlink(id);
21690
9836
ALTER TABLE ONLY hwsubmissiondevice
21691
9837
ADD CONSTRAINT hwsubmissiondevice_parent_fkey FOREIGN KEY (parent) REFERENCES hwsubmissiondevice(id);
21694
9839
ALTER TABLE ONLY hwsubmissiondevice
21695
9840
ADD CONSTRAINT hwsubmissiondevice_submission_fkey FOREIGN KEY (submission) REFERENCES hwsubmission(id);
21698
9842
ALTER TABLE ONLY hwtestanswer
21699
9843
ADD CONSTRAINT hwtestanswer__choice__test__fk FOREIGN KEY (test, choice) REFERENCES hwtestanswerchoice(test, id);
21702
9845
ALTER TABLE ONLY hwtestanswer
21703
9846
ADD CONSTRAINT hwtestanswer_choice_fkey FOREIGN KEY (choice) REFERENCES hwtestanswerchoice(id);
21706
9848
ALTER TABLE ONLY hwtestanswer
21707
9849
ADD CONSTRAINT hwtestanswer_language_fkey FOREIGN KEY (language) REFERENCES language(id);
21710
9851
ALTER TABLE ONLY hwtestanswer
21711
9852
ADD CONSTRAINT hwtestanswer_submission_fkey FOREIGN KEY (submission) REFERENCES hwsubmission(id);
21714
9854
ALTER TABLE ONLY hwtestanswer
21715
9855
ADD CONSTRAINT hwtestanswer_test_fkey FOREIGN KEY (test) REFERENCES hwtest(id);
21718
9857
ALTER TABLE ONLY hwtestanswerchoice
21719
9858
ADD CONSTRAINT hwtestanswerchoice_test_fkey FOREIGN KEY (test) REFERENCES hwtest(id);
21722
9860
ALTER TABLE ONLY hwtestanswercount
21723
9861
ADD CONSTRAINT hwtestanswercount_choice_fkey FOREIGN KEY (choice) REFERENCES hwtestanswerchoice(id);
21726
9863
ALTER TABLE ONLY hwtestanswercount
21727
9864
ADD CONSTRAINT hwtestanswercount_distroarchseries_fkey FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
21730
9866
ALTER TABLE ONLY hwtestanswercount
21731
9867
ADD CONSTRAINT hwtestanswercount_test_fkey FOREIGN KEY (test) REFERENCES hwtest(id);
21734
9869
ALTER TABLE ONLY hwtestanswercountdevice
21735
9870
ADD CONSTRAINT hwtestanswercountdevice_answer_fkey FOREIGN KEY (answer) REFERENCES hwtestanswercount(id);
21738
9872
ALTER TABLE ONLY hwtestanswercountdevice
21739
9873
ADD CONSTRAINT hwtestanswercountdevice_device_driver_fkey FOREIGN KEY (device_driver) REFERENCES hwdevicedriverlink(id);
21742
9875
ALTER TABLE ONLY hwtestanswerdevice
21743
9876
ADD CONSTRAINT hwtestanswerdevice_answer_fkey FOREIGN KEY (answer) REFERENCES hwtestanswer(id);
21746
9878
ALTER TABLE ONLY hwtestanswerdevice
21747
9879
ADD CONSTRAINT hwtestanswerdevice_device_driver_fkey FOREIGN KEY (device_driver) REFERENCES hwdevicedriverlink(id);
21750
9881
ALTER TABLE ONLY hwvendorid
21751
9882
ADD CONSTRAINT hwvendorid_vendor_name_fkey FOREIGN KEY (vendor_name) REFERENCES hwvendorname(id);
21754
9884
ALTER TABLE ONLY ircid
21755
9885
ADD CONSTRAINT ircid_person_fk FOREIGN KEY (person) REFERENCES person(id);
21758
9887
ALTER TABLE ONLY jabberid
21759
9888
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;
21766
9890
ALTER TABLE ONLY job
21767
9891
ADD CONSTRAINT job_requester_fkey FOREIGN KEY (requester) REFERENCES person(id);
21770
9893
ALTER TABLE ONLY karma
21771
9894
ADD CONSTRAINT karma_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
21774
9896
ALTER TABLE ONLY karma
21775
9897
ADD CONSTRAINT karma_person_fk FOREIGN KEY (person) REFERENCES person(id);
21778
9899
ALTER TABLE ONLY karma
21779
9900
ADD CONSTRAINT karma_product_fkey FOREIGN KEY (product) REFERENCES product(id);
21782
9902
ALTER TABLE ONLY karma
21783
9903
ADD CONSTRAINT karma_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
21786
9905
ALTER TABLE ONLY karmaaction
21787
9906
ADD CONSTRAINT karmaaction_category_fk FOREIGN KEY (category) REFERENCES karmacategory(id);
21790
9908
ALTER TABLE ONLY karmacache
21791
9909
ADD CONSTRAINT karmacache_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
21794
9911
ALTER TABLE ONLY karmacache
21795
9912
ADD CONSTRAINT karmacache_product_fkey FOREIGN KEY (product) REFERENCES product(id);
21798
9914
ALTER TABLE ONLY karmacache
21799
9915
ADD CONSTRAINT karmacache_project_fkey FOREIGN KEY (project) REFERENCES project(id);
21802
9917
ALTER TABLE ONLY karmacache
21803
9918
ADD CONSTRAINT karmacache_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
21806
9920
ALTER TABLE ONLY karmatotalcache
21807
9921
ADD CONSTRAINT karmatotalcache_person_fk FOREIGN KEY (person) REFERENCES person(id) ON DELETE CASCADE;
21810
9923
ALTER TABLE ONLY languagepack
21811
9924
ADD CONSTRAINT languagepack__file__fk FOREIGN KEY (file) REFERENCES libraryfilealias(id);
21814
9926
ALTER TABLE ONLY languagepack
21815
9927
ADD CONSTRAINT languagepack__updates__fk FOREIGN KEY (updates) REFERENCES languagepack(id);
21818
9929
ALTER TABLE ONLY languagepack
21819
9930
ADD CONSTRAINT languagepackage__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21822
9932
ALTER TABLE ONLY libraryfiledownloadcount
21823
9933
ADD CONSTRAINT libraryfiledownloadcount__libraryfilealias__fk FOREIGN KEY (libraryfilealias) REFERENCES libraryfilealias(id) ON DELETE CASCADE;
21826
9935
ALTER TABLE ONLY libraryfiledownloadcount
21827
9936
ADD CONSTRAINT libraryfiledownloadcount_country_fkey FOREIGN KEY (country) REFERENCES country(id);
21830
9938
ALTER TABLE ONLY logintoken
21831
9939
ADD CONSTRAINT logintoken_requester_fk FOREIGN KEY (requester) REFERENCES person(id);
21834
9941
ALTER TABLE ONLY mailinglist
21835
9942
ADD CONSTRAINT mailinglist_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
21838
9944
ALTER TABLE ONLY mailinglist
21839
9945
ADD CONSTRAINT mailinglist_reviewer_fkey FOREIGN KEY (reviewer) REFERENCES person(id);
21842
9947
ALTER TABLE ONLY mailinglist
21843
9948
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);
21846
9956
ALTER TABLE ONLY mailinglistsubscription
21847
9957
ADD CONSTRAINT mailinglistsubscription__email_address_fk FOREIGN KEY (email_address) REFERENCES emailaddress(id) ON DELETE CASCADE;
21850
9959
ALTER TABLE ONLY mailinglistsubscription
21851
9960
ADD CONSTRAINT mailinglistsubscription_mailing_list_fkey FOREIGN KEY (mailing_list) REFERENCES mailinglist(id);
21854
9962
ALTER TABLE ONLY mailinglistsubscription
21855
9963
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);
21858
9977
ALTER TABLE ONLY mergedirectivejob
21859
9978
ADD CONSTRAINT mergedirectivejob_job_fkey FOREIGN KEY (job) REFERENCES job(id) ON DELETE CASCADE;
21862
9980
ALTER TABLE ONLY mergedirectivejob
21863
9981
ADD CONSTRAINT mergedirectivejob_merge_directive_fkey FOREIGN KEY (merge_directive) REFERENCES libraryfilealias(id);
21866
9983
ALTER TABLE ONLY message
21867
9984
ADD CONSTRAINT message_distribution_fk FOREIGN KEY (distribution) REFERENCES distribution(id);
21870
9986
ALTER TABLE ONLY message
21871
9987
ADD CONSTRAINT message_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
21874
9989
ALTER TABLE ONLY message
21875
9990
ADD CONSTRAINT message_parent_fk FOREIGN KEY (parent) REFERENCES message(id);
21878
9992
ALTER TABLE ONLY message
21879
9993
ADD CONSTRAINT message_raw_fk FOREIGN KEY (raw) REFERENCES libraryfilealias(id);
21882
9995
ALTER TABLE ONLY messageapproval
21883
9996
ADD CONSTRAINT messageapproval_disposed_by_fkey FOREIGN KEY (disposed_by) REFERENCES person(id);
21886
9998
ALTER TABLE ONLY messageapproval
21887
9999
ADD CONSTRAINT messageapproval_mailing_list_fkey FOREIGN KEY (mailing_list) REFERENCES mailinglist(id);
21890
10001
ALTER TABLE ONLY messageapproval
21891
10002
ADD CONSTRAINT messageapproval_message_fkey FOREIGN KEY (message) REFERENCES message(id);
21894
10004
ALTER TABLE ONLY messageapproval
21895
10005
ADD CONSTRAINT messageapproval_posted_by_fkey FOREIGN KEY (posted_by) REFERENCES person(id);
21898
10007
ALTER TABLE ONLY messageapproval
21899
10008
ADD CONSTRAINT messageapproval_posted_message_fkey FOREIGN KEY (posted_message) REFERENCES libraryfilealias(id);
21902
10010
ALTER TABLE ONLY messagechunk
21903
10011
ADD CONSTRAINT messagechunk_blob_fk FOREIGN KEY (blob) REFERENCES libraryfilealias(id);
21906
10013
ALTER TABLE ONLY messagechunk
21907
10014
ADD CONSTRAINT messagechunk_message_fk FOREIGN KEY (message) REFERENCES message(id);
21910
10016
ALTER TABLE ONLY milestone
21911
10017
ADD CONSTRAINT milestone__distroseries__distribution__fk FOREIGN KEY (distroseries, distribution) REFERENCES distroseries(id, distribution);
21914
10019
ALTER TABLE ONLY milestone
21915
10020
ADD CONSTRAINT milestone__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21918
10022
ALTER TABLE ONLY milestone
21919
10023
ADD CONSTRAINT milestone_distribution_fk FOREIGN KEY (distribution) REFERENCES distribution(id);
21922
10025
ALTER TABLE ONLY milestone
21923
10026
ADD CONSTRAINT milestone_product_fk FOREIGN KEY (product) REFERENCES product(id);
21926
10028
ALTER TABLE ONLY milestone
21927
10029
ADD CONSTRAINT milestone_product_series_fk FOREIGN KEY (product, productseries) REFERENCES productseries(product, id);
21930
10031
ALTER TABLE ONLY milestone
21931
10032
ADD CONSTRAINT milestone_productseries_fk FOREIGN KEY (productseries) REFERENCES productseries(id);
21934
10034
ALTER TABLE ONLY mirror
21935
10035
ADD CONSTRAINT mirror_country_fk FOREIGN KEY (country) REFERENCES country(id);
21938
10037
ALTER TABLE ONLY mirror
21939
10038
ADD CONSTRAINT mirror_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
21942
10040
ALTER TABLE ONLY mirrorcdimagedistroseries
21943
10041
ADD CONSTRAINT mirrorcdimagedistroseries__distribution_mirror__fk FOREIGN KEY (distribution_mirror) REFERENCES distributionmirror(id);
21946
10043
ALTER TABLE ONLY mirrorcdimagedistroseries
21947
10044
ADD CONSTRAINT mirrorcdimagedistroseries__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21950
10046
ALTER TABLE ONLY mirrorcontent
21951
10047
ADD CONSTRAINT mirrorcontent__distroarchseries__fk FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
21954
10049
ALTER TABLE ONLY mirrorcontent
21955
10050
ADD CONSTRAINT mirrorcontent_component_fk FOREIGN KEY (component) REFERENCES component(id);
21958
10052
ALTER TABLE ONLY mirrorcontent
21959
10053
ADD CONSTRAINT mirrorcontent_mirror_fk FOREIGN KEY (mirror) REFERENCES mirror(id);
21962
10055
ALTER TABLE ONLY mirrordistroarchseries
21963
10056
ADD CONSTRAINT mirrordistroarchseries__component__fk FOREIGN KEY (component) REFERENCES component(id);
21966
10058
ALTER TABLE ONLY mirrordistroarchseries
21967
10059
ADD CONSTRAINT mirrordistroarchseries__distribution_mirror__fk FOREIGN KEY (distribution_mirror) REFERENCES distributionmirror(id);
21970
10061
ALTER TABLE ONLY mirrordistroarchseries
21971
10062
ADD CONSTRAINT mirrordistroarchseries__distroarchseries__fk FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
21974
10064
ALTER TABLE ONLY mirrordistroseriessource
21975
10065
ADD CONSTRAINT mirrordistroseriessource__component__fk FOREIGN KEY (component) REFERENCES component(id);
21978
10067
ALTER TABLE ONLY mirrordistroseriessource
21979
10068
ADD CONSTRAINT mirrordistroseriessource__distribution_mirror__fk FOREIGN KEY (distribution_mirror) REFERENCES distributionmirror(id);
21982
10070
ALTER TABLE ONLY mirrordistroseriessource
21983
10071
ADD CONSTRAINT mirrordistroseriessource__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21986
10073
ALTER TABLE ONLY mirrorproberecord
21987
10074
ADD CONSTRAINT mirrorproberecord_distribution_mirror_fkey FOREIGN KEY (distribution_mirror) REFERENCES distributionmirror(id);
21990
10076
ALTER TABLE ONLY mirrorproberecord
21991
10077
ADD CONSTRAINT mirrorproberecord_log_file_fkey FOREIGN KEY (log_file) REFERENCES libraryfilealias(id);
21994
10079
ALTER TABLE ONLY mirrorsourcecontent
21995
10080
ADD CONSTRAINT mirrorsourcecontent__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21998
10082
ALTER TABLE ONLY mirrorsourcecontent
21999
10083
ADD CONSTRAINT mirrorsourcecontent_component_fk FOREIGN KEY (component) REFERENCES component(id);
22002
10085
ALTER TABLE ONLY mirrorsourcecontent
22003
10086
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;
22014
10088
ALTER TABLE ONLY oauthaccesstoken
22015
10089
ADD CONSTRAINT oauthaccesstoken_consumer_fkey FOREIGN KEY (consumer) REFERENCES oauthconsumer(id);
22018
10091
ALTER TABLE ONLY oauthaccesstoken
22019
10092
ADD CONSTRAINT oauthaccesstoken_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
22022
10094
ALTER TABLE ONLY oauthaccesstoken
22023
10095
ADD CONSTRAINT oauthaccesstoken_person_fkey FOREIGN KEY (person) REFERENCES person(id);
22026
10097
ALTER TABLE ONLY oauthaccesstoken
22027
10098
ADD CONSTRAINT oauthaccesstoken_product_fkey FOREIGN KEY (product) REFERENCES product(id);
22030
10100
ALTER TABLE ONLY oauthaccesstoken
22031
10101
ADD CONSTRAINT oauthaccesstoken_project_fkey FOREIGN KEY (project) REFERENCES project(id);
22034
10103
ALTER TABLE ONLY oauthaccesstoken
22035
10104
ADD CONSTRAINT oauthaccesstoken_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
22038
10106
ALTER TABLE ONLY oauthnonce
22039
10107
ADD CONSTRAINT oauthnonce__access_token__fk FOREIGN KEY (access_token) REFERENCES oauthaccesstoken(id) ON DELETE CASCADE;
22042
10109
ALTER TABLE ONLY oauthrequesttoken
22043
10110
ADD CONSTRAINT oauthrequesttoken_consumer_fkey FOREIGN KEY (consumer) REFERENCES oauthconsumer(id);
22046
10112
ALTER TABLE ONLY oauthrequesttoken
22047
10113
ADD CONSTRAINT oauthrequesttoken_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
22050
10115
ALTER TABLE ONLY oauthrequesttoken
22051
10116
ADD CONSTRAINT oauthrequesttoken_person_fkey FOREIGN KEY (person) REFERENCES person(id);
22054
10118
ALTER TABLE ONLY oauthrequesttoken
22055
10119
ADD CONSTRAINT oauthrequesttoken_product_fkey FOREIGN KEY (product) REFERENCES product(id);
22058
10121
ALTER TABLE ONLY oauthrequesttoken
22059
10122
ADD CONSTRAINT oauthrequesttoken_project_fkey FOREIGN KEY (project) REFERENCES project(id);
22062
10124
ALTER TABLE ONLY oauthrequesttoken
22063
10125
ADD CONSTRAINT oauthrequesttoken_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
22066
10127
ALTER TABLE ONLY officialbugtag
22067
10128
ADD CONSTRAINT officialbugtag_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
22070
10130
ALTER TABLE ONLY officialbugtag
22071
10131
ADD CONSTRAINT officialbugtag_product_fkey FOREIGN KEY (product) REFERENCES product(id);
22074
10133
ALTER TABLE ONLY officialbugtag
22075
10134
ADD CONSTRAINT officialbugtag_project_fkey FOREIGN KEY (project) REFERENCES project(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;
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);
22086
10145
ALTER TABLE ONLY packagebuild
22087
10146
ADD CONSTRAINT packagebuild__archive__fk FOREIGN KEY (archive) REFERENCES archive(id);
22090
10148
ALTER TABLE ONLY packagebuild
22091
10149
ADD CONSTRAINT packagebuild__build_farm_job__fk FOREIGN KEY (build_farm_job) REFERENCES buildfarmjob(id);
22094
10151
ALTER TABLE ONLY packagebuild
22095
10152
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);
22114
10154
ALTER TABLE ONLY packagecopyrequest
22115
10155
ADD CONSTRAINT packagecopyrequest__sourcearchive__fk FOREIGN KEY (source_archive) REFERENCES archive(id) ON DELETE CASCADE;
22118
10157
ALTER TABLE ONLY packagecopyrequest
22119
10158
ADD CONSTRAINT packagecopyrequest__targetarchive__fk FOREIGN KEY (target_archive) REFERENCES archive(id) ON DELETE CASCADE;
22122
10160
ALTER TABLE ONLY packagecopyrequest
22123
10161
ADD CONSTRAINT packagecopyrequest_requester_fk FOREIGN KEY (requester) REFERENCES person(id);
22126
10163
ALTER TABLE ONLY packagecopyrequest
22127
10164
ADD CONSTRAINT packagecopyrequest_sourcecomponent_fk FOREIGN KEY (source_component) REFERENCES component(id);
22130
10166
ALTER TABLE ONLY packagecopyrequest
22131
10167
ADD CONSTRAINT packagecopyrequest_sourcedistroseries_fk FOREIGN KEY (source_distroseries) REFERENCES distroseries(id);
22134
10169
ALTER TABLE ONLY packagecopyrequest
22135
10170
ADD CONSTRAINT packagecopyrequest_targetcomponent_fk FOREIGN KEY (target_component) REFERENCES component(id);
22138
10172
ALTER TABLE ONLY packagecopyrequest
22139
10173
ADD CONSTRAINT packagecopyrequest_targetdistroseries_fk FOREIGN KEY (target_distroseries) REFERENCES distroseries(id);
22142
10175
ALTER TABLE ONLY packagediff
22143
10176
ADD CONSTRAINT packagediff_diff_content_fkey FOREIGN KEY (diff_content) REFERENCES libraryfilealias(id);
22146
10178
ALTER TABLE ONLY packagediff
22147
10179
ADD CONSTRAINT packagediff_from_source_fkey FOREIGN KEY (from_source) REFERENCES sourcepackagerelease(id);
22150
10181
ALTER TABLE ONLY packagediff
22151
10182
ADD CONSTRAINT packagediff_requester_fkey FOREIGN KEY (requester) REFERENCES person(id);
22154
10184
ALTER TABLE ONLY packagediff
22155
10185
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);
22158
10202
ALTER TABLE ONLY packageset
22159
10203
ADD CONSTRAINT packageset__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22162
10205
ALTER TABLE ONLY packageset
22163
10206
ADD CONSTRAINT packageset__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
22166
10208
ALTER TABLE ONLY packageset
22167
10209
ADD CONSTRAINT packageset__packagesetgroup__fk FOREIGN KEY (packagesetgroup) REFERENCES packagesetgroup(id);
22170
10211
ALTER TABLE ONLY packagesetgroup
22171
10212
ADD CONSTRAINT packagesetgroup__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
22174
10214
ALTER TABLE ONLY packagesetinclusion
22175
10215
ADD CONSTRAINT packagesetinclusion__child__fk FOREIGN KEY (child) REFERENCES packageset(id);
22178
10217
ALTER TABLE ONLY packagesetinclusion
22179
10218
ADD CONSTRAINT packagesetinclusion__parent__fk FOREIGN KEY (parent) REFERENCES packageset(id);
22182
10220
ALTER TABLE ONLY packagesetsources
22183
10221
ADD CONSTRAINT packagesetsources__packageset__fk FOREIGN KEY (packageset) REFERENCES packageset(id);
22186
10223
ALTER TABLE ONLY packageupload
22187
10224
ADD CONSTRAINT packageupload__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
22190
10226
ALTER TABLE ONLY packageupload
22191
10227
ADD CONSTRAINT packageupload__changesfile__fk FOREIGN KEY (changesfile) REFERENCES libraryfilealias(id);
22194
10229
ALTER TABLE ONLY packageupload
22195
10230
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);
22202
10232
ALTER TABLE ONLY packageupload
22203
10233
ADD CONSTRAINT packageupload__signing_key__fk FOREIGN KEY (signing_key) REFERENCES gpgkey(id);
22206
10235
ALTER TABLE ONLY packageuploadbuild
22207
10236
ADD CONSTRAINT packageuploadbuild__packageupload__fk FOREIGN KEY (packageupload) REFERENCES packageupload(id) ON DELETE CASCADE;
22210
10238
ALTER TABLE ONLY packageuploadbuild
22211
10239
ADD CONSTRAINT packageuploadbuild_build_fk FOREIGN KEY (build) REFERENCES binarypackagebuild(id);
22214
10241
ALTER TABLE ONLY packageuploadcustom
22215
10242
ADD CONSTRAINT packageuploadcustom_libraryfilealias_fk FOREIGN KEY (libraryfilealias) REFERENCES libraryfilealias(id);
22218
10244
ALTER TABLE ONLY packageuploadcustom
22219
10245
ADD CONSTRAINT packageuploadcustom_packageupload_fk FOREIGN KEY (packageupload) REFERENCES packageupload(id);
22222
10247
ALTER TABLE ONLY packageuploadsource
22223
10248
ADD CONSTRAINT packageuploadsource__packageupload__fk FOREIGN KEY (packageupload) REFERENCES packageupload(id) ON DELETE CASCADE;
22226
10250
ALTER TABLE ONLY packageuploadsource
22227
10251
ADD CONSTRAINT packageuploadsource__sourcepackagerelease__fk FOREIGN KEY (sourcepackagerelease) REFERENCES sourcepackagerelease(id);
22230
10253
ALTER TABLE ONLY packaging
22231
10254
ADD CONSTRAINT packaging__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22234
10256
ALTER TABLE ONLY packaging
22235
10257
ADD CONSTRAINT packaging_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
22238
10259
ALTER TABLE ONLY packaging
22239
10260
ADD CONSTRAINT packaging_productseries_fk FOREIGN KEY (productseries) REFERENCES productseries(id);
22242
10262
ALTER TABLE ONLY packaging
22243
10263
ADD CONSTRAINT packaging_sourcepackagename_fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
22246
10265
ALTER TABLE ONLY person
22247
10266
ADD CONSTRAINT person__account__fk FOREIGN KEY (account) REFERENCES account(id);
22250
10268
ALTER TABLE ONLY person
22251
10269
ADD CONSTRAINT person__icon__fk FOREIGN KEY (icon) REFERENCES libraryfilealias(id);
22254
10271
ALTER TABLE ONLY person
22255
10272
ADD CONSTRAINT person__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
22258
10274
ALTER TABLE ONLY person
22259
10275
ADD CONSTRAINT person__mugshot__fk FOREIGN KEY (mugshot) REFERENCES libraryfilealias(id);
22262
10277
ALTER TABLE ONLY karmacache
22263
10278
ADD CONSTRAINT person_fk FOREIGN KEY (person) REFERENCES person(id);
22266
10280
ALTER TABLE ONLY person
22267
10281
ADD CONSTRAINT person_language_fk FOREIGN KEY (language) REFERENCES language(id);
22270
10283
ALTER TABLE ONLY person
22271
10284
ADD CONSTRAINT person_merged_fk FOREIGN KEY (merged) REFERENCES person(id);
22274
10286
ALTER TABLE ONLY person
22275
10287
ADD CONSTRAINT person_registrant_fk FOREIGN KEY (registrant) REFERENCES person(id);
22278
10289
ALTER TABLE ONLY person
22279
10290
ADD CONSTRAINT person_teamowner_fk FOREIGN KEY (teamowner) REFERENCES person(id);
22282
10292
ALTER TABLE ONLY personlanguage
22283
10293
ADD CONSTRAINT personlanguage_language_fk FOREIGN KEY (language) REFERENCES language(id);
22286
10295
ALTER TABLE ONLY personlanguage
22287
10296
ADD CONSTRAINT personlanguage_person_fk FOREIGN KEY (person) REFERENCES person(id);
22290
10298
ALTER TABLE ONLY personlocation
22291
10299
ADD CONSTRAINT personlocation_last_modified_by_fkey FOREIGN KEY (last_modified_by) REFERENCES person(id);
22294
10301
ALTER TABLE ONLY personlocation
22295
10302
ADD CONSTRAINT personlocation_person_fkey FOREIGN KEY (person) REFERENCES person(id);
22298
10304
ALTER TABLE ONLY personnotification
22299
10305
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);
22318
10307
ALTER TABLE ONLY pillarname
22319
10308
ADD CONSTRAINT pillarname__alias_for__fk FOREIGN KEY (alias_for) REFERENCES pillarname(id);
22322
10310
ALTER TABLE ONLY pillarname
22323
10311
ADD CONSTRAINT pillarname_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id) ON DELETE CASCADE;
22326
10313
ALTER TABLE ONLY pillarname
22327
10314
ADD CONSTRAINT pillarname_product_fkey FOREIGN KEY (product) REFERENCES product(id) ON DELETE CASCADE;
22330
10316
ALTER TABLE ONLY pillarname
22331
10317
ADD CONSTRAINT pillarname_project_fkey FOREIGN KEY (project) REFERENCES project(id) ON DELETE CASCADE;
22334
10319
ALTER TABLE ONLY pocketchroot
22335
10320
ADD CONSTRAINT pocketchroot__distroarchseries__fk FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
22338
10322
ALTER TABLE ONLY pocketchroot
22339
10323
ADD CONSTRAINT pocketchroot__libraryfilealias__fk FOREIGN KEY (chroot) REFERENCES libraryfilealias(id);
22342
10325
ALTER TABLE ONLY poexportrequest
22343
10326
ADD CONSTRAINT poeportrequest_potemplate_fk FOREIGN KEY (potemplate) REFERENCES potemplate(id);
22346
10328
ALTER TABLE ONLY poexportrequest
22347
10329
ADD CONSTRAINT poexportrequest_person_fk FOREIGN KEY (person) REFERENCES person(id);
22350
10331
ALTER TABLE ONLY poexportrequest
22351
10332
ADD CONSTRAINT poexportrequest_pofile_fk FOREIGN KEY (pofile) REFERENCES pofile(id);
22354
10334
ALTER TABLE ONLY pofile
22355
10335
ADD CONSTRAINT pofile_language_fk FOREIGN KEY (language) REFERENCES language(id);
22358
10337
ALTER TABLE ONLY pofile
22359
10338
ADD CONSTRAINT pofile_lasttranslator_fk FOREIGN KEY (lasttranslator) REFERENCES person(id);
22362
10340
ALTER TABLE ONLY pofile
22363
10341
ADD CONSTRAINT pofile_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
22366
10343
ALTER TABLE ONLY pofile
22367
10344
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);
22378
10346
ALTER TABLE ONLY pofiletranslator
22379
10347
ADD CONSTRAINT pofiletranslator__latest_message__fk FOREIGN KEY (latest_message) REFERENCES translationmessage(id) DEFERRABLE INITIALLY DEFERRED;
22382
10349
ALTER TABLE ONLY pofiletranslator
22383
10350
ADD CONSTRAINT pofiletranslator__person__fk FOREIGN KEY (person) REFERENCES person(id);
22386
10352
ALTER TABLE ONLY pofiletranslator
22387
10353
ADD CONSTRAINT pofiletranslator__pofile__fk FOREIGN KEY (pofile) REFERENCES pofile(id);
22390
10355
ALTER TABLE ONLY poll
22391
10356
ADD CONSTRAINT poll_team_fk FOREIGN KEY (team) REFERENCES person(id);
22394
10358
ALTER TABLE ONLY potemplate
22395
10359
ADD CONSTRAINT potemplate__distrorelease__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22398
10361
ALTER TABLE ONLY potemplate
22399
10362
ADD CONSTRAINT potemplate__from_sourcepackagename__fk FOREIGN KEY (from_sourcepackagename) REFERENCES sourcepackagename(id);
22402
10364
ALTER TABLE ONLY potemplate
22403
10365
ADD CONSTRAINT potemplate__source_file__fk FOREIGN KEY (source_file) REFERENCES libraryfilealias(id);
22406
10367
ALTER TABLE ONLY potemplate
22407
10368
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);
22414
10370
ALTER TABLE ONLY potemplate
22415
10371
ADD CONSTRAINT potemplate_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
22418
10373
ALTER TABLE ONLY potemplate
22419
10374
ADD CONSTRAINT potemplate_productseries_fk FOREIGN KEY (productseries) REFERENCES productseries(id);
22422
10376
ALTER TABLE ONLY potemplate
22423
10377
ADD CONSTRAINT potemplate_sourcepackagename_fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
22426
10379
ALTER TABLE ONLY potmsgset
22427
10380
ADD CONSTRAINT potmsgset__msgid_plural__fk FOREIGN KEY (msgid_plural) REFERENCES pomsgid(id);
22430
10382
ALTER TABLE ONLY potmsgset
22431
10383
ADD CONSTRAINT potmsgset_potemplate_fk FOREIGN KEY (potemplate) REFERENCES potemplate(id);
22434
10385
ALTER TABLE ONLY potmsgset
22435
10386
ADD CONSTRAINT potmsgset_primemsgid_fk FOREIGN KEY (msgid_singular) REFERENCES pomsgid(id);
22438
10388
ALTER TABLE ONLY previewdiff
22439
10389
ADD CONSTRAINT previewdiff_diff_fkey FOREIGN KEY (diff) REFERENCES diff(id) ON DELETE CASCADE;
22442
10391
ALTER TABLE ONLY product
22443
10392
ADD CONSTRAINT product__development_focus__fk FOREIGN KEY (development_focus) REFERENCES productseries(id);
22446
10394
ALTER TABLE ONLY product
22447
10395
ADD CONSTRAINT product__icon__fk FOREIGN KEY (icon) REFERENCES libraryfilealias(id);
22450
10397
ALTER TABLE ONLY product
22451
10398
ADD CONSTRAINT product__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
22454
10400
ALTER TABLE ONLY product
22455
10401
ADD CONSTRAINT product__mugshot__fk FOREIGN KEY (mugshot) REFERENCES libraryfilealias(id);
22458
10403
ALTER TABLE ONLY product
22459
10404
ADD CONSTRAINT product__translation_focus__fk FOREIGN KEY (translation_focus) REFERENCES productseries(id);
22462
10406
ALTER TABLE ONLY product
22463
10407
ADD CONSTRAINT product_bugtracker_fkey FOREIGN KEY (bugtracker) REFERENCES bugtracker(id);
22466
10409
ALTER TABLE ONLY product
22467
10410
ADD CONSTRAINT product_driver_fk FOREIGN KEY (driver) REFERENCES person(id);
22470
10412
ALTER TABLE ONLY product
22471
10413
ADD CONSTRAINT product_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
22474
10415
ALTER TABLE ONLY product
22475
10416
ADD CONSTRAINT product_project_fk FOREIGN KEY (project) REFERENCES project(id);
22478
10418
ALTER TABLE ONLY product
22479
10419
ADD CONSTRAINT product_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
22482
10421
ALTER TABLE ONLY product
22483
10422
ADD CONSTRAINT product_security_contact_fkey FOREIGN KEY (security_contact) REFERENCES person(id);
22486
10424
ALTER TABLE ONLY product
22487
10425
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);
22490
10436
ALTER TABLE ONLY productlicense
22491
10437
ADD CONSTRAINT productlicense_product_fkey FOREIGN KEY (product) REFERENCES product(id);
22494
10439
ALTER TABLE ONLY productrelease
22495
10440
ADD CONSTRAINT productrelease_milestone_fkey FOREIGN KEY (milestone) REFERENCES milestone(id);
22498
10442
ALTER TABLE ONLY productrelease
22499
10443
ADD CONSTRAINT productrelease_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
22502
10445
ALTER TABLE ONLY productreleasefile
22503
10446
ADD CONSTRAINT productreleasefile__signature__fk FOREIGN KEY (signature) REFERENCES libraryfilealias(id);
22506
10448
ALTER TABLE ONLY productreleasefile
22507
10449
ADD CONSTRAINT productreleasefile__uploader__fk FOREIGN KEY (uploader) REFERENCES person(id);
22510
10451
ALTER TABLE ONLY productseries
22511
10452
ADD CONSTRAINT productseries_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
22514
10454
ALTER TABLE ONLY productseries
22515
10455
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);
22522
10457
ALTER TABLE ONLY productseries
22523
10458
ADD CONSTRAINT productseries_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
22526
10460
ALTER TABLE ONLY productseries
22527
10461
ADD CONSTRAINT productseries_product_fk FOREIGN KEY (product) REFERENCES product(id);
22530
10463
ALTER TABLE ONLY productseries
22531
10464
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);
22534
10475
ALTER TABLE ONLY project
22535
10476
ADD CONSTRAINT project__icon__fk FOREIGN KEY (icon) REFERENCES libraryfilealias(id);
22538
10478
ALTER TABLE ONLY project
22539
10479
ADD CONSTRAINT project__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
22542
10481
ALTER TABLE ONLY project
22543
10482
ADD CONSTRAINT project__mugshot__fk FOREIGN KEY (mugshot) REFERENCES libraryfilealias(id);
22546
10484
ALTER TABLE ONLY project
22547
10485
ADD CONSTRAINT project_bugtracker_fkey FOREIGN KEY (bugtracker) REFERENCES bugtracker(id);
22550
10487
ALTER TABLE ONLY project
22551
10488
ADD CONSTRAINT project_driver_fk FOREIGN KEY (driver) REFERENCES person(id);
22554
10490
ALTER TABLE ONLY project
22555
10491
ADD CONSTRAINT project_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
22558
10493
ALTER TABLE ONLY project
22559
10494
ADD CONSTRAINT project_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
22562
10496
ALTER TABLE ONLY project
22563
10497
ADD CONSTRAINT project_translationgroup_fk FOREIGN KEY (translationgroup) REFERENCES translationgroup(id);
22566
ALTER TABLE ONLY publisherconfig
22567
ADD CONSTRAINT publisherconfig__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(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);
22570
10511
ALTER TABLE ONLY question
22571
10512
ADD CONSTRAINT question__answer__fk FOREIGN KEY (answer) REFERENCES questionmessage(id);
22574
10514
ALTER TABLE ONLY question
22575
10515
ADD CONSTRAINT question__answerer__fk FOREIGN KEY (answerer) REFERENCES person(id);
22578
10517
ALTER TABLE ONLY question
22579
10518
ADD CONSTRAINT question__assignee__fk FOREIGN KEY (assignee) REFERENCES person(id);
22582
10520
ALTER TABLE ONLY question
22583
10521
ADD CONSTRAINT question__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
22586
10523
ALTER TABLE ONLY question
22587
10524
ADD CONSTRAINT question__faq__fk FOREIGN KEY (faq) REFERENCES faq(id);
22590
10526
ALTER TABLE ONLY question
22591
10527
ADD CONSTRAINT question__language__fkey FOREIGN KEY (language) REFERENCES language(id);
22594
10529
ALTER TABLE ONLY question
22595
10530
ADD CONSTRAINT question__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
22598
10532
ALTER TABLE ONLY question
22599
10533
ADD CONSTRAINT question__product__fk FOREIGN KEY (product) REFERENCES product(id);
22602
10535
ALTER TABLE ONLY question
22603
10536
ADD CONSTRAINT question__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
22606
10538
ALTER TABLE ONLY questionbug
22607
10539
ADD CONSTRAINT questionbug__bug__fk FOREIGN KEY (bug) REFERENCES bug(id);
22610
10541
ALTER TABLE ONLY questionbug
22611
10542
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);
22622
10544
ALTER TABLE ONLY questionmessage
22623
10545
ADD CONSTRAINT questionmessage__message__fk FOREIGN KEY (message) REFERENCES message(id);
22626
10547
ALTER TABLE ONLY questionmessage
22627
10548
ADD CONSTRAINT questionmessage__question__fk FOREIGN KEY (question) REFERENCES question(id);
22630
10550
ALTER TABLE ONLY questionreopening
22631
10551
ADD CONSTRAINT questionreopening__answerer__fk FOREIGN KEY (answerer) REFERENCES person(id);
22634
10553
ALTER TABLE ONLY questionreopening
22635
10554
ADD CONSTRAINT questionreopening__question__fk FOREIGN KEY (question) REFERENCES question(id);
22638
10556
ALTER TABLE ONLY questionreopening
22639
10557
ADD CONSTRAINT questionreopening__reopener__fk FOREIGN KEY (reopener) REFERENCES person(id);
22642
10559
ALTER TABLE ONLY questionsubscription
22643
10560
ADD CONSTRAINT questionsubscription__person__fk FOREIGN KEY (person) REFERENCES person(id);
22646
10562
ALTER TABLE ONLY questionsubscription
22647
10563
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);
22650
10568
ALTER TABLE ONLY teammembership
22651
10569
ADD CONSTRAINT reviewer_fk FOREIGN KEY (last_changed_by) REFERENCES person(id);
22654
10571
ALTER TABLE ONLY revision
22655
10572
ADD CONSTRAINT revision_gpgkey_fk FOREIGN KEY (gpgkey) REFERENCES gpgkey(id);
22658
10574
ALTER TABLE ONLY revision
22659
10575
ADD CONSTRAINT revision_revision_author_fk FOREIGN KEY (revision_author) REFERENCES revisionauthor(id);
22662
10577
ALTER TABLE ONLY revisionauthor
22663
10578
ADD CONSTRAINT revisionauthor_person_fkey FOREIGN KEY (person) REFERENCES person(id);
22666
10580
ALTER TABLE ONLY revisioncache
22667
10581
ADD CONSTRAINT revisioncache__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22670
10583
ALTER TABLE ONLY revisioncache
22671
10584
ADD CONSTRAINT revisioncache__product__fk FOREIGN KEY (product) REFERENCES product(id);
22674
10586
ALTER TABLE ONLY revisioncache
22675
10587
ADD CONSTRAINT revisioncache__revision__fk FOREIGN KEY (revision) REFERENCES revision(id);
22678
10589
ALTER TABLE ONLY revisioncache
22679
10590
ADD CONSTRAINT revisioncache__revision_author__fk FOREIGN KEY (revision_author) REFERENCES revisionauthor(id);
22682
10592
ALTER TABLE ONLY revisioncache
22683
10593
ADD CONSTRAINT revisioncache__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
22686
10595
ALTER TABLE ONLY revisionparent
22687
10596
ADD CONSTRAINT revisionparent_revision_fk FOREIGN KEY (revision) REFERENCES revision(id);
22690
10598
ALTER TABLE ONLY revisionproperty
22691
10599
ADD CONSTRAINT revisionproperty__revision__fk FOREIGN KEY (revision) REFERENCES revision(id);
22694
10601
ALTER TABLE ONLY sectionselection
22695
10602
ADD CONSTRAINT sectionselection__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22698
10604
ALTER TABLE ONLY sectionselection
22699
10605
ADD CONSTRAINT sectionselection__section__fk FOREIGN KEY (section) REFERENCES section(id);
22702
10607
ALTER TABLE ONLY binarypackagepublishinghistory
22703
10608
ADD CONSTRAINT securebinarypackagepublishinghistory__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
22706
10610
ALTER TABLE ONLY binarypackagepublishinghistory
22707
10611
ADD CONSTRAINT securebinarypackagepublishinghistory__distroarchseries__fk FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
22710
10613
ALTER TABLE ONLY binarypackagepublishinghistory
22711
10614
ADD CONSTRAINT securebinarypackagepublishinghistory_binarypackagerelease_fk FOREIGN KEY (binarypackagerelease) REFERENCES binarypackagerelease(id);
22714
10616
ALTER TABLE ONLY binarypackagepublishinghistory
22715
10617
ADD CONSTRAINT securebinarypackagepublishinghistory_component_fk FOREIGN KEY (component) REFERENCES component(id);
22718
10619
ALTER TABLE ONLY binarypackagepublishinghistory
22719
10620
ADD CONSTRAINT securebinarypackagepublishinghistory_removedby_fk FOREIGN KEY (removed_by) REFERENCES person(id);
22722
10622
ALTER TABLE ONLY binarypackagepublishinghistory
22723
10623
ADD CONSTRAINT securebinarypackagepublishinghistory_section_fk FOREIGN KEY (section) REFERENCES section(id);
22726
10625
ALTER TABLE ONLY sourcepackagepublishinghistory
22727
10626
ADD CONSTRAINT securesourcepackagepublishinghistory__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22730
10628
ALTER TABLE ONLY sourcepackagepublishinghistory
22731
10629
ADD CONSTRAINT securesourcepackagepublishinghistory_component_fk FOREIGN KEY (component) REFERENCES component(id);
22734
10631
ALTER TABLE ONLY sourcepackagepublishinghistory
22735
10632
ADD CONSTRAINT securesourcepackagepublishinghistory_removedby_fk FOREIGN KEY (removed_by) REFERENCES person(id);
22738
10634
ALTER TABLE ONLY sourcepackagepublishinghistory
22739
10635
ADD CONSTRAINT securesourcepackagepublishinghistory_section_fk FOREIGN KEY (section) REFERENCES section(id);
22742
10637
ALTER TABLE ONLY sourcepackagepublishinghistory
22743
10638
ADD CONSTRAINT securesourcepackagepublishinghistory_sourcepackagerelease_fk FOREIGN KEY (sourcepackagerelease) REFERENCES sourcepackagerelease(id);
22746
10640
ALTER TABLE ONLY sourcepackagepublishinghistory
22747
10641
ADD CONSTRAINT securesourcepackagepublishinghistory_supersededby_fk FOREIGN KEY (supersededby) REFERENCES sourcepackagerelease(id);
22750
10643
ALTER TABLE ONLY seriessourcepackagebranch
22751
10644
ADD CONSTRAINT seriessourcepackagebranch_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
22754
10646
ALTER TABLE ONLY seriessourcepackagebranch
22755
10647
ADD CONSTRAINT seriessourcepackagebranch_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22758
10649
ALTER TABLE ONLY seriessourcepackagebranch
22759
10650
ADD CONSTRAINT seriessourcepackagebranch_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
22762
10652
ALTER TABLE ONLY seriessourcepackagebranch
22763
10653
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);
22766
10676
ALTER TABLE ONLY signedcodeofconduct
22767
10677
ADD CONSTRAINT signedcodeofconduct_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
22770
10679
ALTER TABLE ONLY signedcodeofconduct
22771
10680
ADD CONSTRAINT signedcodeofconduct_signingkey_fk FOREIGN KEY (owner, signingkey) REFERENCES gpgkey(owner, id) ON UPDATE CASCADE;
22774
10682
ALTER TABLE ONLY sourcepackageformatselection
22775
10683
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);
22782
10685
ALTER TABLE ONLY packagesetsources
22783
10686
ADD CONSTRAINT sourcepackagenamesources__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
22786
10688
ALTER TABLE ONLY sourcepackagepublishinghistory
22787
10689
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);
22802
10691
ALTER TABLE ONLY sourcepackagerecipe
22803
10692
ADD CONSTRAINT sourcepackagerecipe_daily_build_archive_fkey FOREIGN KEY (daily_build_archive) REFERENCES archive(id);
22806
10694
ALTER TABLE ONLY sourcepackagerecipe
22807
10695
ADD CONSTRAINT sourcepackagerecipe_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
22810
10697
ALTER TABLE ONLY sourcepackagerecipe
22811
10698
ADD CONSTRAINT sourcepackagerecipe_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
22814
10700
ALTER TABLE ONLY sourcepackagerecipebuild
22815
10701
ADD CONSTRAINT sourcepackagerecipebuild_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22818
10703
ALTER TABLE ONLY sourcepackagerecipebuild
22819
10704
ADD CONSTRAINT sourcepackagerecipebuild_manifest_fkey FOREIGN KEY (manifest) REFERENCES sourcepackagerecipedata(id);
22822
10706
ALTER TABLE ONLY sourcepackagerecipebuild
22823
10707
ADD CONSTRAINT sourcepackagerecipebuild_package_build_fkey FOREIGN KEY (package_build) REFERENCES packagebuild(id);
22826
10709
ALTER TABLE ONLY sourcepackagerecipebuild
22827
10710
ADD CONSTRAINT sourcepackagerecipebuild_recipe_fkey FOREIGN KEY (recipe) REFERENCES sourcepackagerecipe(id);
22830
10712
ALTER TABLE ONLY sourcepackagerecipebuild
22831
10713
ADD CONSTRAINT sourcepackagerecipebuild_requester_fkey FOREIGN KEY (requester) REFERENCES person(id);
22834
10715
ALTER TABLE ONLY sourcepackagerecipebuildjob
22835
10716
ADD CONSTRAINT sourcepackagerecipebuildjob_job_fkey FOREIGN KEY (job) REFERENCES job(id);
22838
10718
ALTER TABLE ONLY sourcepackagerecipebuildjob
22839
10719
ADD CONSTRAINT sourcepackagerecipebuildjob_sourcepackage_recipe_build_fkey FOREIGN KEY (sourcepackage_recipe_build) REFERENCES sourcepackagerecipebuild(id);
22842
10721
ALTER TABLE ONLY sourcepackagerecipedata
22843
10722
ADD CONSTRAINT sourcepackagerecipedata_base_branch_fkey FOREIGN KEY (base_branch) REFERENCES branch(id);
22846
10724
ALTER TABLE ONLY sourcepackagerecipedata
22847
10725
ADD CONSTRAINT sourcepackagerecipedata_sourcepackage_recipe_build_fkey FOREIGN KEY (sourcepackage_recipe_build) REFERENCES sourcepackagerecipebuild(id);
22850
10727
ALTER TABLE ONLY sourcepackagerecipedata
22851
10728
ADD CONSTRAINT sourcepackagerecipedata_sourcepackage_recipe_fkey FOREIGN KEY (sourcepackage_recipe) REFERENCES sourcepackagerecipe(id);
22854
10730
ALTER TABLE ONLY sourcepackagerecipedatainstruction
22855
10731
ADD CONSTRAINT sourcepackagerecipedatainstruction_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
22858
10733
ALTER TABLE ONLY sourcepackagerecipedatainstruction
22859
10734
ADD CONSTRAINT sourcepackagerecipedatainstruction_parent_instruction_fkey FOREIGN KEY (parent_instruction) REFERENCES sourcepackagerecipedatainstruction(id);
22862
10736
ALTER TABLE ONLY sourcepackagerecipedatainstruction
22863
10737
ADD CONSTRAINT sourcepackagerecipedatainstruction_recipe_data_fkey FOREIGN KEY (recipe_data) REFERENCES sourcepackagerecipedata(id);
22866
10739
ALTER TABLE ONLY sourcepackagerecipedistroseries
22867
10740
ADD CONSTRAINT sourcepackagerecipedistroseries_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22870
10742
ALTER TABLE ONLY sourcepackagerecipedistroseries
22871
10743
ADD CONSTRAINT sourcepackagerecipedistroseries_sourcepackagerecipe_fkey FOREIGN KEY (sourcepackagerecipe) REFERENCES sourcepackagerecipe(id);
22874
10745
ALTER TABLE ONLY sourcepackagerelease
22875
10746
ADD CONSTRAINT sourcepackagerelease__creator__fk FOREIGN KEY (creator) REFERENCES person(id);
22878
10748
ALTER TABLE ONLY sourcepackagerelease
22879
10749
ADD CONSTRAINT sourcepackagerelease__dscsigningkey FOREIGN KEY (dscsigningkey) REFERENCES gpgkey(id);
22882
10751
ALTER TABLE ONLY sourcepackagerelease
22883
10752
ADD CONSTRAINT sourcepackagerelease__upload_archive__fk FOREIGN KEY (upload_archive) REFERENCES archive(id);
22886
10754
ALTER TABLE ONLY sourcepackagerelease
22887
10755
ADD CONSTRAINT sourcepackagerelease__upload_distroseries__fk FOREIGN KEY (upload_distroseries) REFERENCES distroseries(id);
22890
10757
ALTER TABLE ONLY sourcepackagerelease
22891
10758
ADD CONSTRAINT sourcepackagerelease_changelog_fkey FOREIGN KEY (changelog) REFERENCES libraryfilealias(id);
22894
10760
ALTER TABLE ONLY sourcepackagerelease
22895
10761
ADD CONSTRAINT sourcepackagerelease_component_fk FOREIGN KEY (component) REFERENCES component(id);
22898
10763
ALTER TABLE ONLY sourcepackagerelease
22899
10764
ADD CONSTRAINT sourcepackagerelease_maintainer_fk FOREIGN KEY (maintainer) REFERENCES person(id);
22902
10766
ALTER TABLE ONLY sourcepackagerelease
22903
10767
ADD CONSTRAINT sourcepackagerelease_section FOREIGN KEY (section) REFERENCES section(id);
22906
10769
ALTER TABLE ONLY sourcepackagerelease
22907
10770
ADD CONSTRAINT sourcepackagerelease_sourcepackage_recipe_build_fkey FOREIGN KEY (sourcepackage_recipe_build) REFERENCES sourcepackagerecipebuild(id);
22910
10772
ALTER TABLE ONLY sourcepackagerelease
22911
10773
ADD CONSTRAINT sourcepackagerelease_sourcepackagename_fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
22914
10775
ALTER TABLE ONLY specification
22915
10776
ADD CONSTRAINT specification__distroseries__distribution__fk FOREIGN KEY (distroseries, distribution) REFERENCES distroseries(id, distribution);
22918
10778
ALTER TABLE ONLY specification
22919
10779
ADD CONSTRAINT specification_approver_fk FOREIGN KEY (approver) REFERENCES person(id);
22922
10781
ALTER TABLE ONLY specification
22923
10782
ADD CONSTRAINT specification_assignee_fk FOREIGN KEY (assignee) REFERENCES person(id);
22926
10784
ALTER TABLE ONLY specification
22927
10785
ADD CONSTRAINT specification_completer_fkey FOREIGN KEY (completer) REFERENCES person(id);
22930
10787
ALTER TABLE ONLY specification
22931
10788
ADD CONSTRAINT specification_distribution_fk FOREIGN KEY (distribution) REFERENCES distribution(id);
22934
10790
ALTER TABLE ONLY specification
22935
10791
ADD CONSTRAINT specification_distribution_milestone_fk FOREIGN KEY (distribution, milestone) REFERENCES milestone(distribution, id);
22938
10793
ALTER TABLE ONLY specification
22939
10794
ADD CONSTRAINT specification_drafter_fk FOREIGN KEY (drafter) REFERENCES person(id);
22942
10796
ALTER TABLE ONLY specification
22943
10797
ADD CONSTRAINT specification_goal_decider_fkey FOREIGN KEY (goal_decider) REFERENCES person(id);
22946
10799
ALTER TABLE ONLY specification
22947
10800
ADD CONSTRAINT specification_goal_proposer_fkey FOREIGN KEY (goal_proposer) REFERENCES person(id);
22950
10802
ALTER TABLE ONLY specification
22951
10803
ADD CONSTRAINT specification_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
22954
10805
ALTER TABLE ONLY specification
22955
10806
ADD CONSTRAINT specification_product_fk FOREIGN KEY (product) REFERENCES product(id);
22958
10808
ALTER TABLE ONLY specification
22959
10809
ADD CONSTRAINT specification_product_milestone_fk FOREIGN KEY (product, milestone) REFERENCES milestone(product, id);
22962
10811
ALTER TABLE ONLY specification
22963
10812
ADD CONSTRAINT specification_productseries_valid FOREIGN KEY (product, productseries) REFERENCES productseries(product, id);
22966
10814
ALTER TABLE ONLY specification
22967
10815
ADD CONSTRAINT specification_starter_fkey FOREIGN KEY (starter) REFERENCES person(id);
22970
10817
ALTER TABLE ONLY specification
22971
10818
ADD CONSTRAINT specification_superseded_by_fk FOREIGN KEY (superseded_by) REFERENCES specification(id);
22974
10820
ALTER TABLE ONLY specificationbranch
22975
10821
ADD CONSTRAINT specificationbranch__branch__fk FOREIGN KEY (branch) REFERENCES branch(id);
22978
10823
ALTER TABLE ONLY specificationbranch
22979
10824
ADD CONSTRAINT specificationbranch__specification__fk FOREIGN KEY (specification) REFERENCES specification(id);
22982
10826
ALTER TABLE ONLY specificationbranch
22983
10827
ADD CONSTRAINT specificationbranch_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
22986
10829
ALTER TABLE ONLY specificationbug
22987
10830
ADD CONSTRAINT specificationbug_bug_fk FOREIGN KEY (bug) REFERENCES bug(id);
22990
10832
ALTER TABLE ONLY specificationbug
22991
10833
ADD CONSTRAINT specificationbug_specification_fk FOREIGN KEY (specification) REFERENCES specification(id);
22994
10835
ALTER TABLE ONLY specificationdependency
22995
10836
ADD CONSTRAINT specificationdependency_dependency_fk FOREIGN KEY (dependency) REFERENCES specification(id);
22998
10838
ALTER TABLE ONLY specificationdependency
22999
10839
ADD CONSTRAINT specificationdependency_specification_fk FOREIGN KEY (specification) REFERENCES specification(id);
23002
10841
ALTER TABLE ONLY specificationfeedback
23003
10842
ADD CONSTRAINT specificationfeedback_provider_fk FOREIGN KEY (reviewer) REFERENCES person(id);
23006
10844
ALTER TABLE ONLY specificationfeedback
23007
10845
ADD CONSTRAINT specificationfeedback_requester_fk FOREIGN KEY (requester) REFERENCES person(id);
23010
10847
ALTER TABLE ONLY specificationfeedback
23011
10848
ADD CONSTRAINT specificationfeedback_specification_fk FOREIGN KEY (specification) REFERENCES specification(id);
23014
10850
ALTER TABLE ONLY specificationmessage
23015
10851
ADD CONSTRAINT specificationmessage__message__fk FOREIGN KEY (message) REFERENCES message(id);
23018
10853
ALTER TABLE ONLY specificationmessage
23019
10854
ADD CONSTRAINT specificationmessage__specification__fk FOREIGN KEY (specification) REFERENCES specification(id);
23022
10856
ALTER TABLE ONLY specificationsubscription
23023
10857
ADD CONSTRAINT specificationsubscription_person_fk FOREIGN KEY (person) REFERENCES person(id);
23026
10859
ALTER TABLE ONLY specificationsubscription
23027
10860
ADD CONSTRAINT specificationsubscription_specification_fk FOREIGN KEY (specification) REFERENCES specification(id);
23030
10862
ALTER TABLE ONLY sprint
23031
10863
ADD CONSTRAINT sprint__icon__fk FOREIGN KEY (icon) REFERENCES libraryfilealias(id);
23034
10865
ALTER TABLE ONLY sprint
23035
10866
ADD CONSTRAINT sprint__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
23038
10868
ALTER TABLE ONLY sprint
23039
10869
ADD CONSTRAINT sprint__mugshot__fk FOREIGN KEY (mugshot) REFERENCES libraryfilealias(id);
23042
10871
ALTER TABLE ONLY sprint
23043
10872
ADD CONSTRAINT sprint_driver_fkey FOREIGN KEY (driver) REFERENCES person(id);
23046
10874
ALTER TABLE ONLY sprint
23047
10875
ADD CONSTRAINT sprint_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
23050
10877
ALTER TABLE ONLY sprintattendance
23051
10878
ADD CONSTRAINT sprintattendance_attendee_fk FOREIGN KEY (attendee) REFERENCES person(id);
23054
10880
ALTER TABLE ONLY sprintattendance
23055
10881
ADD CONSTRAINT sprintattendance_sprint_fk FOREIGN KEY (sprint) REFERENCES sprint(id);
23058
10883
ALTER TABLE ONLY sprintspecification
23059
10884
ADD CONSTRAINT sprintspec_spec_fk FOREIGN KEY (specification) REFERENCES specification(id);
23062
10886
ALTER TABLE ONLY sprintspecification
23063
10887
ADD CONSTRAINT sprintspec_sprint_fk FOREIGN KEY (sprint) REFERENCES sprint(id);
23066
10889
ALTER TABLE ONLY sprintspecification
23067
10890
ADD CONSTRAINT sprintspecification__nominator__fk FOREIGN KEY (registrant) REFERENCES person(id);
23070
10892
ALTER TABLE ONLY sprintspecification
23071
10893
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;
23074
10898
ALTER TABLE ONLY structuralsubscription
23075
10899
ADD CONSTRAINT structuralsubscription_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
23078
10901
ALTER TABLE ONLY structuralsubscription
23079
10902
ADD CONSTRAINT structuralsubscription_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id);
23082
10904
ALTER TABLE ONLY structuralsubscription
23083
10905
ADD CONSTRAINT structuralsubscription_milestone_fkey FOREIGN KEY (milestone) REFERENCES milestone(id);
23086
10907
ALTER TABLE ONLY structuralsubscription
23087
10908
ADD CONSTRAINT structuralsubscription_product_fkey FOREIGN KEY (product) REFERENCES product(id);
23090
10910
ALTER TABLE ONLY structuralsubscription
23091
10911
ADD CONSTRAINT structuralsubscription_productseries_fkey FOREIGN KEY (productseries) REFERENCES productseries(id);
23094
10913
ALTER TABLE ONLY structuralsubscription
23095
10914
ADD CONSTRAINT structuralsubscription_project_fkey FOREIGN KEY (project) REFERENCES project(id);
23098
10916
ALTER TABLE ONLY structuralsubscription
23099
10917
ADD CONSTRAINT structuralsubscription_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
23102
10919
ALTER TABLE ONLY structuralsubscription
23103
10920
ADD CONSTRAINT structuralsubscription_subscribed_by_fkey FOREIGN KEY (subscribed_by) REFERENCES person(id);
23106
10922
ALTER TABLE ONLY structuralsubscription
23107
10923
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;
23126
10925
ALTER TABLE ONLY teammembership
23127
10926
ADD CONSTRAINT teammembership_acknowledged_by_fkey FOREIGN KEY (acknowledged_by) REFERENCES person(id);
23130
10928
ALTER TABLE ONLY teammembership
23131
10929
ADD CONSTRAINT teammembership_person_fk FOREIGN KEY (person) REFERENCES person(id);
23134
10931
ALTER TABLE ONLY teammembership
23135
10932
ADD CONSTRAINT teammembership_proposed_by_fkey FOREIGN KEY (proposed_by) REFERENCES person(id);
23138
10934
ALTER TABLE ONLY teammembership
23139
10935
ADD CONSTRAINT teammembership_reviewed_by_fkey FOREIGN KEY (reviewed_by) REFERENCES person(id);
23142
10937
ALTER TABLE ONLY teammembership
23143
10938
ADD CONSTRAINT teammembership_team_fk FOREIGN KEY (team) REFERENCES person(id);
23146
10940
ALTER TABLE ONLY teamparticipation
23147
10941
ADD CONSTRAINT teamparticipation_person_fk FOREIGN KEY (person) REFERENCES person(id);
23150
10943
ALTER TABLE ONLY teamparticipation
23151
10944
ADD CONSTRAINT teamparticipation_team_fk FOREIGN KEY (team) REFERENCES person(id);
23154
10946
ALTER TABLE ONLY temporaryblobstorage
23155
10947
ADD CONSTRAINT temporaryblobstorage_file_alias_fkey FOREIGN KEY (file_alias) REFERENCES libraryfilealias(id);
23158
10949
ALTER TABLE ONLY translationgroup
23159
10950
ADD CONSTRAINT translationgroup_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
23162
10952
ALTER TABLE ONLY translationimportqueueentry
23163
10953
ADD CONSTRAINT translationimportqueueentry__content__fk FOREIGN KEY (content) REFERENCES libraryfilealias(id);
23166
10955
ALTER TABLE ONLY translationimportqueueentry
23167
10956
ADD CONSTRAINT translationimportqueueentry__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
23170
10958
ALTER TABLE ONLY translationimportqueueentry
23171
10959
ADD CONSTRAINT translationimportqueueentry__importer__fk FOREIGN KEY (importer) REFERENCES person(id);
23174
10961
ALTER TABLE ONLY translationimportqueueentry
23175
10962
ADD CONSTRAINT translationimportqueueentry__pofile__fk FOREIGN KEY (pofile) REFERENCES pofile(id);
23178
10964
ALTER TABLE ONLY translationimportqueueentry
23179
10965
ADD CONSTRAINT translationimportqueueentry__potemplate__fk FOREIGN KEY (potemplate) REFERENCES potemplate(id);
23182
10967
ALTER TABLE ONLY translationimportqueueentry
23183
10968
ADD CONSTRAINT translationimportqueueentry__productseries__fk FOREIGN KEY (productseries) REFERENCES productseries(id);
23186
10970
ALTER TABLE ONLY translationimportqueueentry
23187
10971
ADD CONSTRAINT translationimportqueueentry__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
23190
10973
ALTER TABLE ONLY translationmessage
23191
10974
ADD CONSTRAINT translationmessage__msgstr0__fk FOREIGN KEY (msgstr0) REFERENCES potranslation(id);
23194
10976
ALTER TABLE ONLY translationmessage
23195
10977
ADD CONSTRAINT translationmessage__msgstr1__fk FOREIGN KEY (msgstr1) REFERENCES potranslation(id);
23198
10979
ALTER TABLE ONLY translationmessage
23199
10980
ADD CONSTRAINT translationmessage__msgstr2__fk FOREIGN KEY (msgstr2) REFERENCES potranslation(id);
23202
10982
ALTER TABLE ONLY translationmessage
23203
10983
ADD CONSTRAINT translationmessage__msgstr3__fk FOREIGN KEY (msgstr3) REFERENCES potranslation(id);
23206
10985
ALTER TABLE ONLY translationmessage
23207
10986
ADD CONSTRAINT translationmessage__msgstr4__fk FOREIGN KEY (msgstr4) REFERENCES potranslation(id);
23210
10988
ALTER TABLE ONLY translationmessage
23211
10989
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);
23214
10994
ALTER TABLE ONLY translationmessage
23215
10995
ADD CONSTRAINT translationmessage__potmsgset__fk FOREIGN KEY (potmsgset) REFERENCES potmsgset(id);
23218
10997
ALTER TABLE ONLY translationmessage
23219
10998
ADD CONSTRAINT translationmessage__reviewer__fk FOREIGN KEY (reviewer) REFERENCES person(id);
23222
11000
ALTER TABLE ONLY translationmessage
23223
11001
ADD CONSTRAINT translationmessage__submitter__fk FOREIGN KEY (submitter) REFERENCES person(id);
23226
11003
ALTER TABLE ONLY translationmessage
23227
11004
ADD CONSTRAINT translationmessage_language_fkey FOREIGN KEY (language) REFERENCES language(id);
23230
11006
ALTER TABLE ONLY translationmessage
23231
11007
ADD CONSTRAINT translationmessage_potemplate_fkey FOREIGN KEY (potemplate) REFERENCES potemplate(id);
23234
11009
ALTER TABLE ONLY translationrelicensingagreement
23235
11010
ADD CONSTRAINT translationrelicensingagreement__person__fk FOREIGN KEY (person) REFERENCES person(id);
23238
11012
ALTER TABLE ONLY translationtemplateitem
23239
11013
ADD CONSTRAINT translationtemplateitem_potemplate_fkey FOREIGN KEY (potemplate) REFERENCES potemplate(id);
23242
11015
ALTER TABLE ONLY translationtemplateitem
23243
11016
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);
23254
11018
ALTER TABLE ONLY translator
23255
11019
ADD CONSTRAINT translator_language_fk FOREIGN KEY (language) REFERENCES language(id);
23258
11021
ALTER TABLE ONLY translator
23259
11022
ADD CONSTRAINT translator_person_fk FOREIGN KEY (translator) REFERENCES person(id);
23262
11024
ALTER TABLE ONLY translator
23263
11025
ADD CONSTRAINT translator_translationgroup_fk FOREIGN KEY (translationgroup) REFERENCES translationgroup(id);
23266
11027
ALTER TABLE ONLY usertouseremail
23267
11028
ADD CONSTRAINT usertouseremail__recipient__fk FOREIGN KEY (recipient) REFERENCES person(id);
23270
11030
ALTER TABLE ONLY usertouseremail
23271
11031
ADD CONSTRAINT usertouseremail__sender__fk FOREIGN KEY (sender) REFERENCES person(id);
23274
11033
ALTER TABLE ONLY vote
23275
11034
ADD CONSTRAINT vote_person_fk FOREIGN KEY (person) REFERENCES person(id);
23278
11036
ALTER TABLE ONLY vote
23279
11037
ADD CONSTRAINT vote_poll_fk FOREIGN KEY (poll) REFERENCES poll(id);
23282
11039
ALTER TABLE ONLY vote
23283
11040
ADD CONSTRAINT vote_poll_option_fk FOREIGN KEY (poll, option) REFERENCES polloption(poll, id);
23286
11042
ALTER TABLE ONLY votecast
23287
11043
ADD CONSTRAINT votecast_person_fk FOREIGN KEY (person) REFERENCES person(id);
23290
11045
ALTER TABLE ONLY votecast
23291
11046
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);
23294
11057
ALTER TABLE ONLY wikiname
23295
11058
ADD CONSTRAINT wikiname_person_fk FOREIGN KEY (person) REFERENCES person(id);
11060
-- debversion datatype, which will be added to production manually
11061
\i /usr/share/postgresql/8.4/contrib/debversion.sql