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

Error in restoring SQL dump with virtual columns after upgrade to version 10.6.15

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • 10.6.15
    • N/A
    • Virtual Columns
    • None
    • Ubuntu 22.04

    Description

      After upgrading to MariaDB 10.6.15 from 10.6.10, I tried restoring an SQL dump which worked on the previous version, but now fails with errors like:

      ERROR 1901 (HY000) at line 512844: Function or expression 'id_dipendente' cannot be used in the GENERATED ALWAYS AS clause of `tipo_persona`
      

      Here is the table which generated the error:

      CREATE TABLE `lin_98_68_persone` (
        `id_persona` int(10) unsigned NOT NULL AUTO_INCREMENT,
        `id_azienda` int(10) unsigned NOT NULL DEFAULT 1,
        `id_sede` int(10) unsigned NOT NULL DEFAULT 1,
        `revisione_documento` int(10) unsigned NOT NULL DEFAULT 0,
        `cognome_nome` varchar(255) DEFAULT NULL,
        `mansione_ruolo` text DEFAULT NULL,
        `ragione_sociale` varchar(255) DEFAULT NULL,
        `tipo_persona` enum('D','F','E') GENERATED ALWAYS AS (if(`id_dipendente` is not null,'D',if(`id_dipendente_fornitore` is not null,'F','E'))) STORED,
        `flag_consenso` tinyint(3) unsigned DEFAULT 2,
        `data_consenso` date DEFAULT NULL,
        `documento_tipo` enum('N','PAT','PAS','CI') DEFAULT 'N',
        `documento_codice` varchar(255) DEFAULT NULL,
        `documento_emissione` varchar(255) DEFAULT NULL,
        `documento_emissione_data` date DEFAULT NULL,
        `documento_scadenza_data` date DEFAULT NULL,
        `id_allegato` int(10) unsigned DEFAULT NULL,
        `id_dipendente` int(10) unsigned DEFAULT NULL,
        `id_dipendente_fornitore` int(10) unsigned DEFAULT NULL,
        `id_impresa` int(10) unsigned DEFAULT NULL,
        `flag_attivo` tinyint(1) DEFAULT NULL,
        PRIMARY KEY (`id_persona`,`id_azienda`,`id_sede`,`revisione_documento`),
        UNIQUE KEY `unique_id_dipendente_lin_98_68_persone` (`id_dipendente`,`id_azienda`,`id_sede`,`revisione_documento`),
        UNIQUE KEY `unique_id_dipendente_fornitore_lin_98_68_persone` (`id_dipendente_fornitore`,`id_azienda`,`id_sede`,`revisione_documento`),
        KEY `fk_main_lin_98_68_persone` (`id_azienda`,`id_sede`,`revisione_documento`),
        KEY `fk_id_dipendente_lin_98_68_persone` (`cognome_nome`,`id_azienda`,`id_sede`,`revisione_documento`,`id_dipendente`),
        KEY `fk_id_dipendente_fornitore_lin_98_68_persone` (`cognome_nome`,`id_azienda`,`id_sede`,`revisione_documento`,`id_dipendente_fornitore`,`id_impresa`),
        KEY `fk_id_impresa_lin_98_68_persone` (`id_impresa`,`id_azienda`,`id_sede`,`revisione_documento`,`ragione_sociale`),
        KEY `fk_id_allegato_lin_98_68_persone` (`id_allegato`)
      ) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
      

      if I change "STORED" to "VIRTUAL", I can then restore the SQL dump; however, I do not understand why a minor upgrade causes this problem.

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              mtassinari Matteo Tassinari
              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.