#1483·atlas

sql/mariadb support for MariaDB-style executable comments - problem with semicolon and empty query

Author: pestankoCreated Feb 27, 2023Updated Sep 29, 2026

I was trying to run the migration (MySQL/MariaDB) dump and got the error "Query was empty". I suspect that the comments are skipped and the only remaining part will be the semicolon ;.

But according to documentation, this is incorrect and these comments should be executed.

Error:

Migrating to version 20220905113817 (1 migrations in total):

  -- migrating version 20220905113817
    -> ;
    Error 1065 (42000): Query was empty

  -------------------------
  -- 7.319995ms
  -- 0 migrations ok (1 with errors)
  -- 0 sql statements ok (1 with errors)
Error: sql/migrate: execute: executing statement ";" from version "20220905113817": Error 1065 (42000): Query was empty

Tricky part of the migration:

sql
-- ------------------------------------------------------
-- Server version	10.5.13-MariaDB-1:10.5.13+maria~stretch-log

/*!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 */;

Do you plan to add support for executable comments?