Skip to content

Broken master PG::UndefinedColumn: ERROR: column con.consrc does not exist

Multiple jobs are failing with failure related to con.consrc.

rspec migration job: https://gitlab.com/gitlab-org/gitlab/-/jobs/774217182

  1) DedupMrMetrics deduplicates merge_request_metrics table
     Failure/Error: connection.exec_query(check_sql)
     StandardError:
       An error has occurred, all later migrations canceled:
       PG::UndefinedColumn: ERROR:  column con.consrc does not exist
       LINE 6:   con.consrc as constraint_def
                 ^
       HINT:  Perhaps you meant to reference the column "con.conkey" or the column "con.conbin".
     # ./lib/gitlab/database/migration_helpers.rb:1351:in `check_constraints_for'
     # ./lib/gitlab/database/migration_helpers.rb:1176:in `copy_check_constraints'
     # ./lib/gitlab/database/migration_helpers.rb:1433:in `create_column_from'
     # ./lib/gitlab/database/migration_helpers.rb:606:in `undo_cleanup_concurrent_column_rename'
     # ./db/post_migrate/20200912153218_cleanup_admin_notification_email_application_setting_rename.rb:15:in `down'
     # ./spec/support/helpers/migrations_helpers.rb:108:in `block in schema_migrate_down!'
     # ./spec/support/helpers/migrations_helpers.rb:128:in `disable_migrations_output'
     # ./spec/support/helpers/migrations_helpers.rb:107:in `schema_migrate_down!'
     # ./ee/spec/support/helpers/ee/migrations_helpers.rb:33:in `block in schema_migrate_down!'
     # ./ee/spec/support/helpers/ee/migrations_helpers.rb:50:in `with_db_config'
     # ./ee/spec/support/helpers/ee/migrations_helpers.rb:33:in `schema_migrate_down!'
     # ./spec/support/migration.rb:16:in `block (2 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # PG::UndefinedColumn:
     #   ERROR:  column con.consrc does not exist
     #   LINE 6:   con.consrc as constraint_def
     #             ^
     #   HINT:  Perhaps you meant to reference the column "con.conkey" or the column "con.conbin".
     #   ./lib/gitlab/database/migration_helpers.rb:1351:in `check_constraints_for'

rspec unit: https://gitlab.com/gitlab-org/gitlab/-/jobs/774217201

Failures:
  1) Gitlab::Database::MigrationHelpers#rename_column_concurrently outside a transaction when the column to rename exists with existing records and type casting copies the value to the new column using the type_cast_function
     Failure/Error: connection.exec_query(check_sql)
     ActiveRecord::StatementInvalid:
       PG::UndefinedColumn: ERROR:  column con.consrc does not exist
       LINE 6:   con.consrc as constraint_def
                 ^
       HINT:  Perhaps you meant to reference the column "con.conkey" or the column "con.conbin".
     # ./lib/gitlab/database/migration_helpers.rb:1351:in `check_constraints_for'
     # ./lib/gitlab/database/migration_helpers.rb:1176:in `copy_check_constraints'
     # ./lib/gitlab/database/migration_helpers.rb:1433:in `create_column_from'
     # ./lib/gitlab/database/migration_helpers.rb:493:in `rename_column_concurrently'
     # ./spec/lib/gitlab/database/migration_helpers_spec.rb:719:in `block (6 levels) in <top (required)>'
     # ./spec/spec_helper.rb:340:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:331:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:327:in `block (3 levels) in <top (required)>'
     # ./spec/spec_helper.rb:327:in `block (2 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # PG::UndefinedColumn:
     #   ERROR:  column con.consrc does not exist
     #   LINE 6:   con.consrc as constraint_def
     #             ^
     #   HINT:  Perhaps you meant to reference the column "con.conkey" or the column "con.conbin".
     #   ./lib/gitlab/database/migration_helpers.rb:1351:in `check_constraints_for'
Edited by Albert Salim