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

JSON alias causes constraints to be skipped

    XMLWordPrintable

Details

    Description

      This command successfully creates the table:

      create table `test` (`id` bigint unsigned not null auto_increment primary key, `user_id` bigint unsigned not null, `additionalData` json null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci'

      This command successfully creates the test_user_id_foreign key, but it does not create the constraint:

      alter table `test` add constraint `test_user_id_foreign` foreign key (`user_id`) references `users` (`id`) on delete cascade

      If I use LONGTEXT instead of JSON as data type for the "additionalData" field, it works however.
      I also tested it on a version 10.3.11 server, here it works both with json and longtext.

      All queries run without throwing any exceptions

      Attachments

        Activity

          People

            Unassigned Unassigned
            CodingKiwi Erik
            Votes:
            0 Vote for this issue
            Watchers:
            4 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.