Schema health check error : Incorrect ownership on sequence detected after upgrade to 18.8.2
<!--IssueSummary start-->
<details>
<summary>
Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards.
</summary>
- [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=590912)
</details>
<!--IssueSummary end-->
Hello.
Context:\
The instance is a self hosted docker version gitlab/gitlab-ce:18.8.2-ce.0 , and was previously on 18.5.5.\
I do not have exactly the history of all the upgrade, but i always check the upgrade path before upgrade from one version to over so normally i should not have missed a version needed. (it’s an old server that was build in 2021 if i am not wrong but upgraded a lot of time since).
I have got a problem reported by the Database Diagnostics option in the admin area.\
The Schema health check report an error of incorrect ownership for the sequence “public.board_labels_id_seq”
[{width="690" height="231"}](https://us1.discourse-cdn.com/gitlab/original/3X/1/f/1fd9082139aca90221b5c47ca297c64e5fec71b1.png "image")
[image1361×457 17.7 KB](https://us1.discourse-cdn.com/gitlab/original/3X/1/f/1fd9082139aca90221b5c47ca297c64e5fec71b1.png "image")
It’s the first time i found this option whereas it seems it exist since a little moment but i have missed it.
I have tried to find information by my self, but did not find the correct solution.
If i take a look with:\
`SELECT s.schemaname, s.sequencename, d.objid::regclass AS sequence_full_name, d.refobjid::regclass AS owned_by_table, a.attname AS owned_by_column FROM pg_sequences s JOIN pg_class c ON c.relname = s.sequencename JOIN pg_depend d ON d.objid = c.oid AND d.deptype = 'a' JOIN pg_attribute a ON a.attrelid = d.refobjid AND a.attnum = d.refobjsubid WHERE s.schemaname = 'public' AND s.sequencename = 'board_labels_id_seq';`
It report me:\
`schemaname | sequencename | sequence_full_name | owned_by_table | owned_by_column`\
`------------+---------------------+---------------------+--------------------------------------------------------+-----------------`\
` public | board_labels_id_seq | board_labels_id_seq | p_ci_job_artifacts | locked`\
` public | board_labels_id_seq | board_labels_id_seq | gitlab_partitions_dynamic.instance_audit_events_202302 | entity_path`
So should be related to an “old” things from 202302 if i am not wrong.
Thank’s.
issue