Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-34309

CHECK TABLE should check that foreign key relations are correct

Details

    Description

      Currently there is no easy way for a user to check if a database is consistent.
      One can check individual tables with CHECK TABLE but there is now to check that
      all foreign key tables has all the required keys and that the original table has all the rows
      expected by the foreign key table.

      We should extended CHECK TABLE .. EXTENDED or alternative CHECK TABLE ... REFERENCES to check that all foreign key relations are consistent.

      This should preferably be done on the upper, sql, level and not in InnoDB.

      Attachments

        Issue Links

          Activity

            I rebased it on main to bb-11.8-check-table.

            I also see 8 commits there who review other 4 ?

            sanja Oleksandr Byelkin added a comment - I rebased it on main to bb-11.8-check-table. I also see 8 commits there who review other 4 ?

            Sergei reviews them.

            nikitamalyavin Nikita Malyavin added a comment - Sergei reviews them.

            It is OK to push after renaming commits related to this MDEV starting with: MDEV-34309, i.e something like this.:

            MDEV-34309 prereq. FOREIGN_KEY_INFO: Store Lex_* strings without extra pointer indirection.

            MDEV-34309 prereq. Fix deallocation of Sql_cmd_dml::result

            Just to link them to the task which inspeared you for such changes (I'd put the MDEV-34309 before your cleanup also)

            sanja Oleksandr Byelkin added a comment - It is OK to push after renaming commits related to this MDEV starting with: MDEV-34309 , i.e something like this.: MDEV-34309 prereq. FOREIGN_KEY_INFO: Store Lex_* strings without extra pointer indirection. MDEV-34309 prereq. Fix deallocation of Sql_cmd_dml::result Just to link them to the task which inspeared you for such changes (I'd put the MDEV-34309 before your cleanup also)

            cleanup is ok too

            serg Sergei Golubchik added a comment - cleanup is ok too

            It's been agreed that the feature won't go to 11.8 as we try to find legacy issues when

            • foreign keys are claimed to be broken when they should be okay (example: MDEV-35962),
            • foreign keys pretend to work when they probably shouldn't (example: MDEV-35908, INET6 column referencing TIME column),
            • there is no clarity whether the foreign keys should work or not (example: MDEV-35936 – different field lengths, more in the comments to MDEV-35908) – this may be just a documentation issue, but it would be really good to get it documented while we are at it.

            The goal is to avoid the hard choice between releasing CHECK which alerts about fake problems, or CHECK which doesn't show real problems, or CHECK which is inconsistent with DML/DDL related to the same foreign keys.

            Thus, while the bugs will probably be fixed outside the scope of this task, as the fixes would go to earlier versions when possible, the testing scope of the task will increase.

            elenst Elena Stepanova added a comment - It's been agreed that the feature won't go to 11.8 as we try to find legacy issues when foreign keys are claimed to be broken when they should be okay (example: MDEV-35962 ), foreign keys pretend to work when they probably shouldn't (example: MDEV-35908 , INET6 column referencing TIME column), there is no clarity whether the foreign keys should work or not (example: MDEV-35936 – different field lengths, more in the comments to MDEV-35908 ) – this may be just a documentation issue, but it would be really good to get it documented while we are at it. The goal is to avoid the hard choice between releasing CHECK which alerts about fake problems, or CHECK which doesn't show real problems, or CHECK which is inconsistent with DML/DDL related to the same foreign keys. Thus, while the bugs will probably be fixed outside the scope of this task, as the fixes would go to earlier versions when possible, the testing scope of the task will increase.

            People

              elenst Elena Stepanova
              monty Michael Widenius
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.