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

Unable to restore a Oracle package after creation

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Confirmed (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.3.25
    • Fix Version/s: 10.3, 10.4, 10.5
    • Component/s: Scripts & Clients
    • Labels:
      None
    • Environment:
      Ubuntu 20.04.1 LTS, 10.3.25+maria~focal

      Description

      Since version 10.3.5 MariaDB has supported for Oracle packages and when creating one with:

      SET SQL_MODE='ORACLE';
      DELIMITER ;;
      CREATE PACKAGE "jobsched" AS
          PROCEDURE test;
      END ;;
      DELIMITER ;
      

      and doing backup with:

      mysqldump --opt --single-transaction --default-character-set=utf8mb4 --disable-keys --routines --events --triggers greyhat_dkdefault > greyhat_dkdefault.sql
      

      I get

      - MySQL dump 10.17  Distrib 10.3.25-MariaDB, for debian-linux-gnu (x86_64)
      --
      -- Host: localhost    Database: greyhat_dkdefault
      -- ------------------------------------------------------
      -- Server version	10.3.25-MariaDB-1:10.3.25+maria~focal
       
      /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
      /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
      /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
      /*!40101 SET NAMES utf8mb4 */;
      /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
      /*!40103 SET TIME_ZONE='+00:00' */;
      /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
      /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
      /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
      /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
       
      --
      -- Dumping events for database 'greyhat_dkdefault'
      --
       
      --
      -- Dumping routines for database 'greyhat_dkdefault'
      --
      /*!50003 DROP PACKAGE IF EXISTS `jobsched` */;
      /*!50003 SET @saved_cs_client      = @@character_set_client */ ;
      /*!50003 SET @saved_cs_results     = @@character_set_results */ ;
      /*!50003 SET @saved_col_connection = @@collation_connection */ ;
      /*!50003 SET character_set_client  = utf8 */ ;
      /*!50003 SET character_set_results = utf8 */ ;
      /*!50003 SET collation_connection  = utf8_general_ci */ ;
      /*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
      /*!50003 SET sql_mode              = 'PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT' */ ;
      DELIMITER ;;
      CREATE DEFINER="greyhat_dkdefault"@"%" PACKAGE "jobsched" AS
          PROCEDURE test;
      END ;;
      DELIMITER ;
      /*!50003 SET sql_mode              = @saved_sql_mode */ ;
      /*!50003 SET character_set_client  = @saved_cs_client */ ;
      /*!50003 SET character_set_results = @saved_cs_results */ ;
      /*!50003 SET collation_connection  = @saved_col_connection */ ;
      /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
       
      /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
      /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
      /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
      /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
      /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
      /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
      /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
       
      -- Dump completed on 2021-01-18  8:11:28
      

      but when restoring it I get an syntax error on DROP PACKAGE because the Oracle mode is not set

      ERROR 1064 (42000) at line 25 in file: 'greyhat_dkdefault.sql': You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PACKAGE IF EXISTS `jobsched` */' at line 1
      

      If I manually change the DROP PACKAGE to:

      SET SQL_MODE='ORACLE';
      /*!50003 DROP PACKAGE IF EXISTS `jobsched` */;
      

      The restore works

        Attachments

          Activity

            People

            Assignee:
            sanja Oleksandr Byelkin
            Reporter:
            Desdic Kim Gert Nielsen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Git Integration