[MDEV-30168] mysqldump doesn't have an option for check_constraint_checks Created: 2022-12-06  Updated: 2022-12-26

Status: Open
Project: MariaDB Server
Component/s: Backup
Fix Version/s: None

Type: Task Priority: Minor
Reporter: KB Benton Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

mysqldump doesn't have an option for check_constraint_checks on tables that implement a constraint check. That makes it impossible to restore tables completely when the table has invalid data in it and check_constraint_checks was turned off when the constraint was implemented.

For example,

SET @@session.check_constraint_checks = 0 ;
ALTER TABLE foo ADD CONSTRAINT json_valid_bar CHECK(JSON_VALID(bar));

... is run with a few rows of known bad data in it then a mysqldump is run, it's not possible to do a full restore without mangling the backup. If mysqldump had --check-constraint-checks=0 as an option, we could tell the dump to put SET @@SESSION.CHECK_CONSTRAINT_CHECKS = 0 in it on tables that have a constraint on them or for the entire backup... You get the idea.


Generated at Thu Feb 08 10:14:10 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.