WARNING: Active Record does not support composite primary key
Summary
During work on a ticket (internal link) relating to project import/export, the customer noticed new warnings at GitLab 13.6 importing the project using the Rails console:
TABLE has composite primary key. Composite primary key is ignored.
WARNING: Active Record does not support composite primary key.
These new warnings were also noticed in our test logs etc. A summary of internal discussion(s) on Slack:
- A number of tables had primary keys added, for example !45198 (merged)
- The tables had unique composite keys before, but they were not marked as primary. These composite keys were promoted.
- This is to fix an issue relating to replication; turning on logical replication breaks without a primary key.
- The warning comes from ActiveRecord
- At this time, while the warnings are annoying, but no functionality is thought to be affected.
The purpose of this issue is to make a publicly searchable record of this warning in the issue tracker. Setting it low priority and severity: the warnings may get suppressed at some point.
Steps to reproduce
Example Project
What is the current bug behavior?
What is the expected correct behavior?
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)