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

CREATE TABLE ... LIKE ... - drop column without droping key with it

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • 10.2.13
    • N/A
    • None
    • Windows 7 x64

    Description

      Trying to run script. Got error: "Key column 'id' doesn't exist in table"

      DROP TABLE IF EXISTS promotions;
      CREATE TABLE `promotions` (
        id mediumint(6) unsigned NOT NULL AUTO_INCREMENT,
        `d_start` date NOT NULL,
        `d_end` date NOT NULL,
        `prioritet` char(3) NOT NULL,
        `buh_grp` tinyint(1) unsigned NOT NULL DEFAULT 1,
        `title` varchar(30) NOT NULL,
        `opisanie` text NOT NULL,
        `ts_created` datetime NOT NULL,
        `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
        PRIMARY KEY (`id`),
        UNIQUE KEY `d_start` (`d_start`,`d_end`,`id`)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
      ALTER TABLE promotions DROP PRIMARY KEY, DROP COLUMN `id`, DROP COLUMN ts_created, DROP COLUMN ts;
      

      Attachments

        Activity

          People

            serg Sergei Golubchik
            alewin Alexander Zimnitski
            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.