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

Clean up some DDL code around FOREIGN KEY constraints

    XMLWordPrintable

Details

    Description

      In MDEV-17938 a second bool parameter was added to the function row_rename_table_for_mysql(), which is part of RENAME TABLE and also other DDL operations that rebuild tables. An earlier parameter bool commit had been removed in MDEV-25506.

      In a MDEV-25292 branch bb-main-midenok-MDEV-25292, a parameter bool cmd_alter was added to row_rename_table_for_mysql(). It would have been better to replace the existing bool use_fk parameter with an enum:

      enum rename_fk {
        /** ignore FOREIGN KEY constraints */
        RENAME_IGNORE_FK= 0,
        /** parse and enforce FOREIGN KEY constaints */
        RENAME_FK,
        /** Rename a table as part of a native table-rebuilding DDL operation */
        RENAME_REBUILD,
        /** Rename as part of ALTER TABLE...ALGORITHM=COPY */
        RENAME_ALTER_COPY
      };
      

      Part of this change could simplify some logic around FOREIGN KEY constraints in table-rebuilding operations, such as TRUNCATE TABLE.

      Another change that seems to be needed both for MDEV-25506 and MDEV-19191 is simplifying the function dict_get_referenced_table().

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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