Trying to upgrade the schema here (in staging) and hit:
... 0UPDATE 26508475 ERROR: constraint "rpminfo_build_id_fkey" of relation "rpminfo" does not exist ERROR: current transaction is aborted, commands ignored until end of transaction block ERROR: current transaction is aborted, commands ignored until end of transaction block ERROR: current transaction is aborted, commands ignored until end of transaction block ERROR: current transaction is aborted, commands ignored until end of transaction block ROLLBACK
I don't see any record of rpminfo_build_id_fkey being added anywhere...
Commenting that line and the upgrade finishes fine.
A fresh application of the 1.33.0 schema, with the update applied, matches the 1.34.0 schema for me, modulo the ordering of fields in the pg_dump output.
pg_dump
The rpminfo_build_id_fkey constraint is created by postgres because the table definition includes a foreign key constraint on the rpminfo.build_id field. I.e. this line in the table definition.
rpminfo_build_id_fkey
build_id INTEGER REFERENCES build (id)
It is possible that in your db, the constraint was named differently, perhap long ago by an older version of postgres or by manual tinkering. Check the output of \d rpminfo in psql.
\d rpminfo
It shouldn't break anything to leave it there. It's just made redundant by the newer rpminfo_build_id_draft_fkey constraint.
rpminfo_build_id_draft_fkey
Metadata Update from @mikem: - Custom field Size adjusted to None
Table "public.rpminfo" Column | Type | Collation | Nullable | Default ------------------+-----------------------+-----------+----------+----------------------------------- -- id | integer | | not null | nextval('rpminfo_id_seq'::regclass ) build_id | integer | | | buildroot_id | integer | | | name | text | | not null | version | text | | not null | release | text | | not null | epoch | integer | | | arch | character varying(16) | | not null | payloadhash | text | | not null | size | bigint | | not null | buildtime | bigint | | not null | external_repo_id | integer | | not null | metadata_only | boolean | | not null | false extra | text | | | draft | boolean | | | Indexes: "rpminfo_pkey" PRIMARY KEY, btree (id) "rpminfo_build" btree (build_id) "rpminfo_buildroot" btree (buildroot_id) "rpminfo_filename" btree ((((((((name || '-'::text) || version) || '-'::text) || release) || '.': :text) || arch::text) || '.rpm'::text)) INCLUDE (id) "rpminfo_unique_nvra_not_draft" UNIQUE, btree (name, version, release, arch, external_repo_id) WH ERE draft IS NOT TRUE Check constraints: "build_id_draft_external_repo_id_sane" CHECK (draft IS NULL AND build_id IS NULL AND external_rep o_id <> 0 OR draft IS NOT NULL AND build_id IS NOT NULL AND external_repo_id = 0) Foreign-key constraints: "$1" FOREIGN KEY (build_id) REFERENCES build(id) "$2" FOREIGN KEY (buildroot_id) REFERENCES buildroot(id) "rpminfo_build_id_draft_fkey" FOREIGN KEY (build_id, draft) REFERENCES build(id, draft) ON UPDATE CASCADE "rpminfo_external_repo_id_fkey" FOREIGN KEY (external_repo_id) REFERENCES external_repo(id) Referenced by: TABLE "rpmsigs" CONSTRAINT "$1" FOREIGN KEY (rpm_id) REFERENCES rpminfo(id) TABLE "buildroot_listing" CONSTRAINT "$2" FOREIGN KEY (rpm_id) REFERENCES rpminfo(id) TABLE "archive_rpm_components" CONSTRAINT "archive_rpm_components_rpm_id_fkey" FOREIGN KEY (rpm_i d) REFERENCES rpminfo(id) TABLE "image_listing" CONSTRAINT "image_listing_rpm_id_fkey" FOREIGN KEY (rpm_id) REFERENCES rpmi nfo(id) TABLE "imageinfo_listing" CONSTRAINT "imageinfo_listing_rpm_id_fkey" FOREIGN KEY (rpm_id) REFEREN CES rpminfo(id) TABLE "rpm_checksum" CONSTRAINT "rpm_checksum_rpm_id_fkey" FOREIGN KEY (rpm_id) REFERENCES rpminf o(id)
Foreign-key constraints: "$1" FOREIGN KEY (build_id) REFERENCES build(id)
Yes, different constraint names. This foreign key has been the same in since day 1. You could drop this one if you like, but leaving it should also be fine (perhaps a tiny performance hit). It's still accurate to the data model, just redundant.
ok, thanks. I'll just leave it alone then...
Metadata Update from @tkopecek: - Issue close_status updated to: Invalid - Issue status updated to: Closed (was: Open)
This issue has been migrated to Fedora Forge: https://forge.fedoraproject.org/koji/koji/issues/4003
Please continue any further discussion there.