Bug #34870
closedPG::ForeignKeyViolation: ERROR: update or delete on table "katello_erratum_packages" violates foreign key constraint "katello_msep_erratum_package_id_fk" on table "katello_module_stream_erratum_packages"
Description
Description of problem:
Upgrading to 6.10.5 fails with below error:
root@ctqlsat06 ~]# foreman-rake db:migrate --trace --verbose'ErbParser' is ignored.
'RubyParser' is ignored.
- Invoke db:migrate (first_time)
- Invoke db:load_config (first_time)
- Invoke environment (first_time)
- Execute environment
API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache. - Execute db:load_config
- Invoke plugin:refresh_migrations (first_time)
- Invoke environment
- Execute plugin:refresh_migrations
- Execute db:migrate
20220303160220 RemoveDuplicateErrata: migrating ==========================
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::ForeignKeyViolation: ERROR: update or delete on table "katello_erratum_packages" violates foreign key constraint "katello_msep_erratum_package_id_fk" on table "katello_module_stream_erratum_packages"
DETAIL: Key (id)=(264838) is still referenced from table "katello_module_stream_erratum_packages".
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/postgresql_adapter.rb:675:in `async_exec_params'
Version-Release number of selected component (if applicable):
How reproducible:
Unknown as it happens on one of the customers' Satellite
Steps to Reproduce:
1.
2.
3.
Actual results:
failed upgrade due to failing db:migrate
Expected results:
successful upgrade
Additional info:
It's quite similar to bz#2075519, but this happens on a different table.