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

Foreign key doesn't always require index on referenced columns

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Not a Bug
    • 5.5.33a
    • None
    • None

    Description

      I discovered a situation where a two-column foreign key constraint doesn't seem to require an index on the referenced columns in the referenced table. I am attaching a repro case that illustrates the scenario, but it is rather complex.

      Basically, there are three tables:

      • Table "A" has one column "a" which is a primary key
      • Table "B" has two columns, "a" which is a foreign key to table "A", and "b" which is a primary key
      • Table "C" has two columns, "a" and "b", which together are a foreign key to the columns in table "B"

      Based on whether table B's foreign key to A is declared inline or separately, table C cannot/can be created.

      Attachments

        Activity

          People

            elenst Elena Stepanova
            pinkston3 Donnie Pinkston
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.