mysql Ver 15.1 Distrib 10.6.13-MariaDB, for Linux (x86_64) using readline 5.1
Ok, phew.
Update! I exported the DB with PhpMyAdmin and imported it, works…!
Awesome.
That doesn’t necessarily make me feel better nor answer the question of why it was happening but I don’t think I’ll be able to troubleshoot any further … so I guess that’s good enough.
My guess is that PhpMyAdmin adds some arguments to the mysqldump command that side steps the issue. So if we need to investigate further that might be one angle we look into.
For anyone else who may run into this issue in the future, what I was going to suggest was to dig into the details of the tables involved.
Product
MariaDB [openboxes]> show create table product \G;
*************************** 1. row ***************************
Table: product
Create Table: CREATE TABLE `product` (
`id` char(38) NOT NULL DEFAULT '',
`version` bigint(20) NOT NULL,
`category_id` char(38) DEFAULT NULL,
`date_created` datetime NOT NULL,
`description` mediumtext DEFAULT NULL,
`last_updated` datetime NOT NULL,
`name` varchar(255) NOT NULL,
`product_code` varchar(255) DEFAULT NULL,
`unit_of_measure_id` char(38) DEFAULT NULL,
`cold_chain` bit(1) DEFAULT NULL,
`manufacturer` varchar(255) DEFAULT NULL,
`manufacturer_code` varchar(255) DEFAULT NULL,
`ndc` varchar(255) DEFAULT NULL,
`upc` varchar(255) DEFAULT NULL,
`unit_of_measure` varchar(255) DEFAULT NULL,
`created_by_id` char(38) DEFAULT NULL,
`updated_by_id` char(38) DEFAULT NULL,
`default_uom_id` char(38) DEFAULT NULL,
`brand_name` varchar(255) DEFAULT NULL,
`vendor` varchar(255) DEFAULT NULL,
`vendor_code` varchar(255) DEFAULT NULL,
`package_size` int(11) DEFAULT NULL,
`model_number` varchar(255) DEFAULT NULL,
`manufacturer_name` varchar(255) DEFAULT NULL,
`vendor_name` varchar(255) DEFAULT NULL,
`active` bit(1) DEFAULT NULL,
`controlled_substance` bit(1) DEFAULT NULL,
`essential` bit(1) DEFAULT NULL,
`hazardous_material` bit(1) DEFAULT NULL,
`lot_control` bit(1) DEFAULT NULL,
`serialized` bit(1) DEFAULT NULL,
`price_per_unit` decimal(19,4) DEFAULT NULL,
`reconditioned` bit(1) DEFAULT NULL,
`product_type_id` char(38) DEFAULT NULL,
`abc_class` varchar(255) DEFAULT NULL,
`cost_per_unit` decimal(19,4) DEFAULT NULL,
`gl_account_id` char(38) DEFAULT NULL,
`lot_and_expiry_control` bit(1) DEFAULT NULL,
`product_family_id` char(38) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `product_code` (`product_code`),
KEY `FKED8DCCEFEF4C770D` (`category_id`),
KEY `FKED8DCCEF217F5972` (`created_by_id`),
KEY `FKED8DCCEFEEB2908D` (`default_uom_id`),
KEY `FKED8DCCEF426DD105` (`updated_by_id`),
KEY `FKED8DCCEFABD88AC6` (`product_type_id`),
KEY `fk_product_gl_account` (`gl_account_id`),
KEY `fk_product_product_family` (`product_family_id`),
CONSTRAINT `FKED8DCCEF217F5972` FOREIGN KEY (`created_by_id`) REFERENCES `user` (`id`),
CONSTRAINT `FKED8DCCEF426DD105` FOREIGN KEY (`updated_by_id`) REFERENCES `user` (`id`),
CONSTRAINT `FKED8DCCEFABD88AC6` FOREIGN KEY (`product_type_id`) REFERENCES `product_type` (`id`),
CONSTRAINT `FKED8DCCEFEEB2908D` FOREIGN KEY (`default_uom_id`) REFERENCES `unit_of_measure` (`id`),
CONSTRAINT `FKED8DCCEFEF4C770D` FOREIGN KEY (`category_id`) REFERENCES `category` (`id`),
CONSTRAINT `fk_product_gl_account` FOREIGN KEY (`gl_account_id`) REFERENCES `gl_account` (`id`),
CONSTRAINT `fk_product_product_family` FOREIGN KEY (`product_family_id`) REFERENCES `product_group` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
1 row in set (0.000 sec)
Product Merge Logger
MariaDB [openboxes]> show create table product_merge_logger \G;
*************************** 1. row ***************************
Table: product_merge_logger
Create Table: CREATE TABLE `product_merge_logger` (
`id` char(38) NOT NULL,
`primary_product_id` char(38) NOT NULL,
`obsolete_product_id` char(38) NOT NULL,
`related_object_id` char(38) NOT NULL,
`related_object_class_name` varchar(255) NOT NULL,
`date_merged` datetime NOT NULL,
`date_reverted` datetime DEFAULT NULL,
`comments` varchar(255) DEFAULT NULL,
`date_created` datetime NOT NULL,
`last_updated` datetime NOT NULL,
`created_by_id` char(38) NOT NULL,
`updated_by_id` char(38) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_product_merge_logger_primary_product` (`primary_product_id`),
KEY `fk_product_merge_logger_obsolete_product` (`obsolete_product_id`),
KEY `fk_product_merge_logger_created_by` (`created_by_id`),
KEY `fk_product_merge_logger_updated_by` (`updated_by_id`),
CONSTRAINT `fk_product_merge_logger_created_by` FOREIGN KEY (`created_by_id`) REFERENCES `user` (`id`),
CONSTRAINT `fk_product_merge_logger_obsolete_product` FOREIGN KEY (`obsolete_product_id`) REFERENCES `product` (`id`),
CONSTRAINT `fk_product_merge_logger_primary_product` FOREIGN KEY (`primary_product_id`) REFERENCES `product` (`id`),
CONSTRAINT `fk_product_merge_logger_updated_by` FOREIGN KEY (`updated_by_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
1 row in set (0.000 sec)
And then maybe take a look at what MySQL/MariaDB thinks the tables look like with particular interest in the table_collation and engine.
MariaDB [openboxes]> select * from information_schema.tables where table_schema = 'openboxes' and table_name in ('product', 'product_merge_logger') \G;
*************************** 1. row ***************************
TABLE_CATALOG: def
TABLE_SCHEMA: openboxes
TABLE_NAME: product_merge_logger
TABLE_TYPE: BASE TABLE
ENGINE: InnoDB
VERSION: 10
ROW_FORMAT: Dynamic
TABLE_ROWS: 31
AVG_ROW_LENGTH: 528
DATA_LENGTH: 16384
MAX_DATA_LENGTH: 0
INDEX_LENGTH: 65536
DATA_FREE: 0
AUTO_INCREMENT: NULL
CREATE_TIME: 2023-05-22 18:11:20
UPDATE_TIME: 2023-05-24 09:35:38
CHECK_TIME: NULL
TABLE_COLLATION: utf8mb3_general_ci
CHECKSUM: NULL
CREATE_OPTIONS:
TABLE_COMMENT:
MAX_INDEX_LENGTH: 0
TEMPORARY: N
*************************** 2. row ***************************
TABLE_CATALOG: def
TABLE_SCHEMA: openboxes
TABLE_NAME: product
TABLE_TYPE: BASE TABLE
ENGINE: InnoDB
VERSION: 10
ROW_FORMAT: Dynamic
TABLE_ROWS: 16236
AVG_ROW_LENGTH: 422
DATA_LENGTH: 6864896
MAX_DATA_LENGTH: 0
INDEX_LENGTH: 16908288
DATA_FREE: 4194304
AUTO_INCREMENT: NULL
CREATE_TIME: 2023-05-22 18:11:20
UPDATE_TIME: 2023-06-05 15:45:27
CHECK_TIME: NULL
TABLE_COLLATION: utf8mb3_general_ci
CHECKSUM: NULL
CREATE_OPTIONS:
TABLE_COMMENT:
MAX_INDEX_LENGTH: 0
TEMPORARY: N
2 rows in set (0.001 sec)
As well as server variables related to character set.
MariaDB [openboxes]> show variables like '%character_set%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8mb3 |
| character_set_connection | utf8mb3 |
| character_set_database | utf8mb3 |
| character_set_filesystem | binary |
| character_set_results | utf8mb3 |
| character_set_server | utf8mb4 |
| character_set_system | utf8mb3 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.001 sec)