Hi Viktor,
Sorry, i found it, it's because I did not quote fields name, I by mistake use a mysql keyword as a column name.
but to avoid this workaround, is it possible to backup and restore a table containing generated column ?
these are steps to reproduce the issue :
1.creating database (use script below)
Code: Select all
--
-- Database medical structure
--
USE mysql;
DROP DATABASE IF EXISTS medical;
CREATE DATABASE medical;
USE medical;
--
-- Table structure for table patients
--
DROP TABLE IF EXISTS patients;
CREATE TABLE `patients` (
`IdPatient` int(11) NOT NULL AUTO_INCREMENT,
`DateNaissance` date DEFAULT NULL,
`Nom` varchar(30) DEFAULT NULL,
`Prenom` varchar(30) DEFAULT NULL,
`Sexe` varchar(1) DEFAULT NULL,
`Adresse` varchar(255) DEFAULT NULL,
`City` varchar(30) DEFAULT NULL,
`Phone` varchar(20) DEFAULT NULL,
`Mail` varchar(60) DEFAULT NULL,
`Notes` text,
`v_PatientName` varchar(255) GENERATED ALWAYS AS (trim(concat(if(isnull(`Prenom`),'',trim(`Prenom`)),' ',if(isnull(`Nom`),'',trim(`Nom`))))) VIRTUAL,
PRIMARY KEY (`IdPatient`),
UNIQUE KEY `IdPatient` (`IdPatient`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 AVG_ROW_LENGTH=208;
--
-- Dumping data for table patients
--
LOCK TABLES patients WRITE;
INSERT INTO patients(IdPatient, DateNaissance, Nom, Prenom, Sexe, Adresse, City, Phone, Mail, Notes) VALUES
(1,NULL,'KHEMIRI73','Aladdine23',NULL,NULL,NULL,NULL,NULL,NULL),
(2,NULL,'KHEMIRI34','Aladdine17',NULL,NULL,NULL,NULL,NULL,NULL),
(3,NULL,'KHEMIRI31','Aladdine28',NULL,NULL,NULL,NULL,NULL,NULL);
UNLOCK TABLES;
2.do backup with
Code: Select all
MyDump1.BackupToFile('mybackup.sql');
3.try to restore :
Code: Select all
MyDump1.RestoreFromFile('mybackup.sql');
Then i get this error :
#HY000The value specified for generated column 'v_PatientName' in table 'patients' is not allowed.
thank you again for your kind help!
Aladdine.