From f01bd7ef8a4ca4a1f214516aae2a6302a9818271 Mon Sep 17 00:00:00 2001 From: Pierre POMES Date: Sun, 4 Oct 2026 10:27:23 -0400 Subject: [PATCH] Anonymize INSERT IGNORE with one space and INSERT DELAYED The scanner only recognized "INSERT IGNORE INTO" with two spaces, as written by mysqldump up to MySQL 9.2. MySQL 9.3+ (MySQL bug #116845) and MariaDB write a single space, and MariaDB can also write INSERT DELAYED. These lines were not recognized and were copied without anonymization. Adds tests made from real dumps of MySQL 9.7 and MariaDB 11. Reported by Yves Blake. Fixes #62. --- Makefile.am | 2 +- main/dumpscanner.l | 4 +- tests/test_insert_delayed_ignore_mariadb.conf | 13 ++++ tests/test_insert_delayed_ignore_mariadb.sql | 58 +++++++++++++++++ ...est_insert_delayed_ignore_mariadb_anon.sql | 58 +++++++++++++++++ tests/test_insert_delayed_mariadb.conf | 13 ++++ tests/test_insert_delayed_mariadb.sql | 58 +++++++++++++++++ tests/test_insert_delayed_mariadb_anon.sql | 58 +++++++++++++++++ tests/test_insert_ignore_mariadb.conf | 13 ++++ tests/test_insert_ignore_mariadb.sql | 60 +++++++++++++++++ tests/test_insert_ignore_mariadb_anon.sql | 60 +++++++++++++++++ tests/test_insert_ignore_mysql9.conf | 13 ++++ tests/test_insert_ignore_mysql9.sql | 65 +++++++++++++++++++ tests/test_insert_ignore_mysql9_anon.sql | 65 +++++++++++++++++++ 14 files changed, 537 insertions(+), 3 deletions(-) create mode 100644 tests/test_insert_delayed_ignore_mariadb.conf create mode 100644 tests/test_insert_delayed_ignore_mariadb.sql create mode 100644 tests/test_insert_delayed_ignore_mariadb_anon.sql create mode 100644 tests/test_insert_delayed_mariadb.conf create mode 100644 tests/test_insert_delayed_mariadb.sql create mode 100644 tests/test_insert_delayed_mariadb_anon.sql create mode 100644 tests/test_insert_ignore_mariadb.conf create mode 100644 tests/test_insert_ignore_mariadb.sql create mode 100644 tests/test_insert_ignore_mariadb_anon.sql create mode 100644 tests/test_insert_ignore_mysql9.conf create mode 100644 tests/test_insert_ignore_mysql9.sql create mode 100644 tests/test_insert_ignore_mysql9_anon.sql diff --git a/Makefile.am b/Makefile.am index ef2dc60..ca2d081 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,7 @@ EXTRA_DIST = $(top_srcdir)/uthash/uthash.h \ $(top_srcdir)/debian/rules \ $(top_srcdir)/debian/source/format -TULIST = test1 test1-insert-ignore null-example appendkey prependkey issue29 issue52 issue55 issue_semicolon_truncate test_substring appendindex prependindex test_regex complex test_json_hyphen_path test_long_table_name test_json_long_values test_json_utf8 +TULIST = test1 test1-insert-ignore null-example appendkey prependkey issue29 issue52 issue55 issue_semicolon_truncate test_substring appendindex prependindex test_regex complex test_json_hyphen_path test_long_table_name test_json_long_values test_json_utf8 test_insert_ignore_mysql9 test_insert_ignore_mariadb test_insert_delayed_mariadb test_insert_delayed_ignore_mariadb PYTULIST = test_python test_large_python test_large_python_2 test_row_context test_pyargs test_latin1 test_pydef_json_long test_pydef_json_paths PYTHON_SUPPORT = @PYTHON_SUPPORT@ diff --git a/main/dumpscanner.l b/main/dumpscanner.l index 6b855a7..be0cb80 100644 --- a/main/dumpscanner.l +++ b/main/dumpscanner.l @@ -131,7 +131,7 @@ static void set_working_table() { } } -^(INSERT|REPLACE)\ (\ IGNORE\ )?\INTO\ `[^`]+`(?:\ \([^\)]+\))? { DUPOUT +^(INSERT|REPLACE)\ +(DELAYED\ +)?(IGNORE\ +)?INTO\ `[^`]+`(?:\ \([^\)]+\))? { DUPOUT if (currenttableconfig) { BEGIN(ST_VALUES); DEBUG_MSG("\nENTERING STATE ST_VALUES") @@ -231,7 +231,7 @@ static void set_working_table() { "-- ".* { DUPOUT } [ ] { DUPOUT } \n { DUPOUT dump_line_nb++;} -^(INSERT|REPLACE)\ (\ IGNORE\ )?\INTO\ `[^`]+`(?:\ \([^\)]+\))? { DUPOUT +^(INSERT|REPLACE)\ +(DELAYED\ +)?(IGNORE\ +)?INTO\ `[^`]+`(?:\ \([^\)]+\))? { DUPOUT if (currenttableconfig) { return INSERT_INTO; } diff --git a/tests/test_insert_delayed_ignore_mariadb.conf b/tests/test_insert_delayed_ignore_mariadb.conf new file mode 100644 index 0000000..8d46107 --- /dev/null +++ b/tests/test_insert_delayed_ignore_mariadb.conf @@ -0,0 +1,13 @@ +# Config file for test_insert_delayed_ignore_mariadb.sql +# +# INSERT IGNORE written with a single space, as by mariadb-dump --insert-ignore. +# These lines used to be copied unchanged, without anonymization (issue #62). +secret = 'lapin' +stats = 'no' + +tables = { + `customers` = { + `email` = emailhash 'example.com' 10 + `name` = texthash 8 + } +} diff --git a/tests/test_insert_delayed_ignore_mariadb.sql b/tests/test_insert_delayed_ignore_mariadb.sql new file mode 100644 index 0000000..be2175b --- /dev/null +++ b/tests/test_insert_delayed_ignore_mariadb.sql @@ -0,0 +1,58 @@ +/*M!999999\- enable the sandbox mode */ +-- MariaDB dump 10.20-11.8.9-MariaDB, for debian-linux-gnu (x86_64) +-- +-- Host: localhost Database: d +-- ------------------------------------------------------ +-- Server version 11.8.9-MariaDB-ubu2404 + +/*!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' */; +/*M!100616 SET @OLD_NOTE_VERBOSITY=@@NOTE_VERBOSITY, NOTE_VERBOSITY=0 */; + +-- +-- Table structure for table `customers` +-- + +DROP TABLE IF EXISTS `customers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `customers` ( + `id` int(11) NOT NULL, + `email` varchar(100) DEFAULT NULL, + `name` varchar(50) DEFAULT NULL, + `city` varchar(50) DEFAULT NULL, + `created` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `customers` +-- + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +/*!40000 ALTER TABLE `customers` DISABLE KEYS */; +INSERT DELAYED IGNORE INTO `customers` VALUES (1,'alice.martin@mail.test','Alice Martin','Lyon','2026-01-15 10:00:00'); +INSERT DELAYED IGNORE INTO `customers` VALUES (2,'bob.oneil@mail.test','Bob O\'Neil','Paris','2026-02-20 11:30:00'); +INSERT DELAYED IGNORE INTO `customers` VALUES (3,'carla.rossi@mail.test','Carla Rossi','Nice',NULL); +/*!40000 ALTER TABLE `customers` ENABLE KEYS */; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +/*!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 */; +/*M!100616 SET NOTE_VERBOSITY=@OLD_NOTE_VERBOSITY */; + +-- Dump completed on 2026-10-04 14:25:31 diff --git a/tests/test_insert_delayed_ignore_mariadb_anon.sql b/tests/test_insert_delayed_ignore_mariadb_anon.sql new file mode 100644 index 0000000..60caa1b --- /dev/null +++ b/tests/test_insert_delayed_ignore_mariadb_anon.sql @@ -0,0 +1,58 @@ +/*M!999999\- enable the sandbox mode */ +-- MariaDB dump 10.20-11.8.9-MariaDB, for debian-linux-gnu (x86_64) +-- +-- Host: localhost Database: d +-- ------------------------------------------------------ +-- Server version 11.8.9-MariaDB-ubu2404 + +/*!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' */; +/*M!100616 SET @OLD_NOTE_VERBOSITY=@@NOTE_VERBOSITY, NOTE_VERBOSITY=0 */; + +-- +-- Table structure for table `customers` +-- + +DROP TABLE IF EXISTS `customers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `customers` ( + `id` int(11) NOT NULL, + `email` varchar(100) DEFAULT NULL, + `name` varchar(50) DEFAULT NULL, + `city` varchar(50) DEFAULT NULL, + `created` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `customers` +-- + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +/*!40000 ALTER TABLE `customers` DISABLE KEYS */; +INSERT DELAYED IGNORE INTO `customers` VALUES (1,'nnuaeelpxb@example.com','qoepvndw','Lyon','2026-01-15 10:00:00'); +INSERT DELAYED IGNORE INTO `customers` VALUES (2,'dlhtusdhgq@example.com','nsesrybi','Paris','2026-02-20 11:30:00'); +INSERT DELAYED IGNORE INTO `customers` VALUES (3,'jgmpfbqars@example.com','bzobifey','Nice',NULL); +/*!40000 ALTER TABLE `customers` ENABLE KEYS */; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +/*!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 */; +/*M!100616 SET NOTE_VERBOSITY=@OLD_NOTE_VERBOSITY */; + +-- Dump completed on 2026-10-04 14:25:31 diff --git a/tests/test_insert_delayed_mariadb.conf b/tests/test_insert_delayed_mariadb.conf new file mode 100644 index 0000000..c7c4b63 --- /dev/null +++ b/tests/test_insert_delayed_mariadb.conf @@ -0,0 +1,13 @@ +# Config file for test_insert_delayed_mariadb.sql +# +# INSERT DELAYED, as written by mariadb-dump --delayed-insert. +# These lines used to be copied unchanged, without anonymization (issue #62). +secret = 'lapin' +stats = 'no' + +tables = { + `customers` = { + `email` = emailhash 'example.com' 10 + `name` = texthash 8 + } +} diff --git a/tests/test_insert_delayed_mariadb.sql b/tests/test_insert_delayed_mariadb.sql new file mode 100644 index 0000000..59e2aee --- /dev/null +++ b/tests/test_insert_delayed_mariadb.sql @@ -0,0 +1,58 @@ +/*M!999999\- enable the sandbox mode */ +-- MariaDB dump 10.20-11.8.9-MariaDB, for debian-linux-gnu (x86_64) +-- +-- Host: localhost Database: d +-- ------------------------------------------------------ +-- Server version 11.8.9-MariaDB-ubu2404 + +/*!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' */; +/*M!100616 SET @OLD_NOTE_VERBOSITY=@@NOTE_VERBOSITY, NOTE_VERBOSITY=0 */; + +-- +-- Table structure for table `customers` +-- + +DROP TABLE IF EXISTS `customers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `customers` ( + `id` int(11) NOT NULL, + `email` varchar(100) DEFAULT NULL, + `name` varchar(50) DEFAULT NULL, + `city` varchar(50) DEFAULT NULL, + `created` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `customers` +-- + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +/*!40000 ALTER TABLE `customers` DISABLE KEYS */; +INSERT DELAYED INTO `customers` VALUES (1,'alice.martin@mail.test','Alice Martin','Lyon','2026-01-15 10:00:00'); +INSERT DELAYED INTO `customers` VALUES (2,'bob.oneil@mail.test','Bob O\'Neil','Paris','2026-02-20 11:30:00'); +INSERT DELAYED INTO `customers` VALUES (3,'carla.rossi@mail.test','Carla Rossi','Nice',NULL); +/*!40000 ALTER TABLE `customers` ENABLE KEYS */; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +/*!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 */; +/*M!100616 SET NOTE_VERBOSITY=@OLD_NOTE_VERBOSITY */; + +-- Dump completed on 2026-10-04 14:25:31 diff --git a/tests/test_insert_delayed_mariadb_anon.sql b/tests/test_insert_delayed_mariadb_anon.sql new file mode 100644 index 0000000..ac6aa51 --- /dev/null +++ b/tests/test_insert_delayed_mariadb_anon.sql @@ -0,0 +1,58 @@ +/*M!999999\- enable the sandbox mode */ +-- MariaDB dump 10.20-11.8.9-MariaDB, for debian-linux-gnu (x86_64) +-- +-- Host: localhost Database: d +-- ------------------------------------------------------ +-- Server version 11.8.9-MariaDB-ubu2404 + +/*!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' */; +/*M!100616 SET @OLD_NOTE_VERBOSITY=@@NOTE_VERBOSITY, NOTE_VERBOSITY=0 */; + +-- +-- Table structure for table `customers` +-- + +DROP TABLE IF EXISTS `customers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `customers` ( + `id` int(11) NOT NULL, + `email` varchar(100) DEFAULT NULL, + `name` varchar(50) DEFAULT NULL, + `city` varchar(50) DEFAULT NULL, + `created` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `customers` +-- + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +/*!40000 ALTER TABLE `customers` DISABLE KEYS */; +INSERT DELAYED INTO `customers` VALUES (1,'nnuaeelpxb@example.com','qoepvndw','Lyon','2026-01-15 10:00:00'); +INSERT DELAYED INTO `customers` VALUES (2,'dlhtusdhgq@example.com','nsesrybi','Paris','2026-02-20 11:30:00'); +INSERT DELAYED INTO `customers` VALUES (3,'jgmpfbqars@example.com','bzobifey','Nice',NULL); +/*!40000 ALTER TABLE `customers` ENABLE KEYS */; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +/*!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 */; +/*M!100616 SET NOTE_VERBOSITY=@OLD_NOTE_VERBOSITY */; + +-- Dump completed on 2026-10-04 14:25:31 diff --git a/tests/test_insert_ignore_mariadb.conf b/tests/test_insert_ignore_mariadb.conf new file mode 100644 index 0000000..2155e02 --- /dev/null +++ b/tests/test_insert_ignore_mariadb.conf @@ -0,0 +1,13 @@ +# Config file for test_insert_ignore_mariadb.sql +# +# INSERT IGNORE written with a single space, as by mariadb-dump --insert-ignore. +# These lines used to be copied unchanged, without anonymization (issue #62). +secret = 'lapin' +stats = 'no' + +tables = { + `customers` = { + `email` = emailhash 'example.com' 10 + `name` = texthash 8 + } +} diff --git a/tests/test_insert_ignore_mariadb.sql b/tests/test_insert_ignore_mariadb.sql new file mode 100644 index 0000000..24526c6 --- /dev/null +++ b/tests/test_insert_ignore_mariadb.sql @@ -0,0 +1,60 @@ +/*M!999999\- enable the sandbox mode */ +-- MariaDB dump 10.20-11.8.9-MariaDB, for debian-linux-gnu (x86_64) +-- +-- Host: localhost Database: d +-- ------------------------------------------------------ +-- Server version 11.8.9-MariaDB-ubu2404 + +/*!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' */; +/*M!100616 SET @OLD_NOTE_VERBOSITY=@@NOTE_VERBOSITY, NOTE_VERBOSITY=0 */; + +-- +-- Table structure for table `customers` +-- + +DROP TABLE IF EXISTS `customers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `customers` ( + `id` int(11) NOT NULL, + `email` varchar(100) DEFAULT NULL, + `name` varchar(50) DEFAULT NULL, + `city` varchar(50) DEFAULT NULL, + `created` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `customers` +-- + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `customers` WRITE; +/*!40000 ALTER TABLE `customers` DISABLE KEYS */; +INSERT IGNORE INTO `customers` VALUES (1,'alice.martin@mail.test','Alice Martin','Lyon','2026-01-15 10:00:00'); +INSERT IGNORE INTO `customers` VALUES (2,'bob.oneil@mail.test','Bob O\'Neil','Paris','2026-02-20 11:30:00'); +INSERT IGNORE INTO `customers` VALUES (3,'carla.rossi@mail.test','Carla Rossi','Nice',NULL); +/*!40000 ALTER TABLE `customers` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +/*!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 */; +/*M!100616 SET NOTE_VERBOSITY=@OLD_NOTE_VERBOSITY */; + +-- Dump completed on 2026-10-04 14:25:30 diff --git a/tests/test_insert_ignore_mariadb_anon.sql b/tests/test_insert_ignore_mariadb_anon.sql new file mode 100644 index 0000000..20388c9 --- /dev/null +++ b/tests/test_insert_ignore_mariadb_anon.sql @@ -0,0 +1,60 @@ +/*M!999999\- enable the sandbox mode */ +-- MariaDB dump 10.20-11.8.9-MariaDB, for debian-linux-gnu (x86_64) +-- +-- Host: localhost Database: d +-- ------------------------------------------------------ +-- Server version 11.8.9-MariaDB-ubu2404 + +/*!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' */; +/*M!100616 SET @OLD_NOTE_VERBOSITY=@@NOTE_VERBOSITY, NOTE_VERBOSITY=0 */; + +-- +-- Table structure for table `customers` +-- + +DROP TABLE IF EXISTS `customers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `customers` ( + `id` int(11) NOT NULL, + `email` varchar(100) DEFAULT NULL, + `name` varchar(50) DEFAULT NULL, + `city` varchar(50) DEFAULT NULL, + `created` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `customers` +-- + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `customers` WRITE; +/*!40000 ALTER TABLE `customers` DISABLE KEYS */; +INSERT IGNORE INTO `customers` VALUES (1,'nnuaeelpxb@example.com','qoepvndw','Lyon','2026-01-15 10:00:00'); +INSERT IGNORE INTO `customers` VALUES (2,'dlhtusdhgq@example.com','nsesrybi','Paris','2026-02-20 11:30:00'); +INSERT IGNORE INTO `customers` VALUES (3,'jgmpfbqars@example.com','bzobifey','Nice',NULL); +/*!40000 ALTER TABLE `customers` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +/*!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 */; +/*M!100616 SET NOTE_VERBOSITY=@OLD_NOTE_VERBOSITY */; + +-- Dump completed on 2026-10-04 14:25:30 diff --git a/tests/test_insert_ignore_mysql9.conf b/tests/test_insert_ignore_mysql9.conf new file mode 100644 index 0000000..221e8d1 --- /dev/null +++ b/tests/test_insert_ignore_mysql9.conf @@ -0,0 +1,13 @@ +# Config file for test_insert_ignore_mysql9.sql +# +# INSERT IGNORE written with a single space, as by mysqldump 9.3+ (MySQL bug #116845). +# These lines used to be copied unchanged, without anonymization (issue #62). +secret = 'lapin' +stats = 'no' + +tables = { + `customers` = { + `email` = emailhash 'example.com' 10 + `name` = texthash 8 + } +} diff --git a/tests/test_insert_ignore_mysql9.sql b/tests/test_insert_ignore_mysql9.sql new file mode 100644 index 0000000..6538d8b --- /dev/null +++ b/tests/test_insert_ignore_mysql9.sql @@ -0,0 +1,65 @@ +-- MySQL dump 10.13 Distrib 9.7.2, for Linux (x86_64) +-- +-- Host: localhost Database: d +-- ------------------------------------------------------ +-- Server version 9.7.2 + +/*!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 */; +/*!50503 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 */; +SET @MYSQLDUMP_TEMP_LOG_BIN = @@SESSION.SQL_LOG_BIN; +SET @@SESSION.SQL_LOG_BIN= 0; + +-- +-- GTID state at the beginning of the backup +-- + +SET @@GLOBAL.GTID_PURGED=/*!80000 '+'*/ 'cfb3c5e2-bff3-11f1-800d-56ef24952fc1:1-11'; + +-- +-- Table structure for table `customers` +-- + +DROP TABLE IF EXISTS `customers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `customers` ( + `id` int NOT NULL, + `email` varchar(100) DEFAULT NULL, + `name` varchar(50) DEFAULT NULL, + `city` varchar(50) DEFAULT NULL, + `created` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `customers` +-- + +LOCK TABLES `customers` WRITE; +/*!40000 ALTER TABLE `customers` DISABLE KEYS */; +INSERT IGNORE INTO `customers` VALUES (1,'alice.martin@mail.test','Alice Martin','Lyon','2026-01-15 10:00:00'); +INSERT IGNORE INTO `customers` VALUES (2,'bob.oneil@mail.test','Bob O\'Neil','Paris','2026-02-20 11:30:00'); +INSERT IGNORE INTO `customers` VALUES (3,'carla.rossi@mail.test','Carla Rossi','Nice',NULL); +/*!40000 ALTER TABLE `customers` ENABLE KEYS */; +UNLOCK TABLES; +SET @@SESSION.SQL_LOG_BIN = @MYSQLDUMP_TEMP_LOG_BIN; +/*!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 2026-10-04 14:25:30 diff --git a/tests/test_insert_ignore_mysql9_anon.sql b/tests/test_insert_ignore_mysql9_anon.sql new file mode 100644 index 0000000..5788a2a --- /dev/null +++ b/tests/test_insert_ignore_mysql9_anon.sql @@ -0,0 +1,65 @@ +-- MySQL dump 10.13 Distrib 9.7.2, for Linux (x86_64) +-- +-- Host: localhost Database: d +-- ------------------------------------------------------ +-- Server version 9.7.2 + +/*!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 */; +/*!50503 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 */; +SET @MYSQLDUMP_TEMP_LOG_BIN = @@SESSION.SQL_LOG_BIN; +SET @@SESSION.SQL_LOG_BIN= 0; + +-- +-- GTID state at the beginning of the backup +-- + +SET @@GLOBAL.GTID_PURGED=/*!80000 '+'*/ 'cfb3c5e2-bff3-11f1-800d-56ef24952fc1:1-11'; + +-- +-- Table structure for table `customers` +-- + +DROP TABLE IF EXISTS `customers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `customers` ( + `id` int NOT NULL, + `email` varchar(100) DEFAULT NULL, + `name` varchar(50) DEFAULT NULL, + `city` varchar(50) DEFAULT NULL, + `created` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `customers` +-- + +LOCK TABLES `customers` WRITE; +/*!40000 ALTER TABLE `customers` DISABLE KEYS */; +INSERT IGNORE INTO `customers` VALUES (1,'nnuaeelpxb@example.com','qoepvndw','Lyon','2026-01-15 10:00:00'); +INSERT IGNORE INTO `customers` VALUES (2,'dlhtusdhgq@example.com','nsesrybi','Paris','2026-02-20 11:30:00'); +INSERT IGNORE INTO `customers` VALUES (3,'jgmpfbqars@example.com','bzobifey','Nice',NULL); +/*!40000 ALTER TABLE `customers` ENABLE KEYS */; +UNLOCK TABLES; +SET @@SESSION.SQL_LOG_BIN = @MYSQLDUMP_TEMP_LOG_BIN; +/*!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 2026-10-04 14:25:30