Reputation: 916
I've this little SQL script:
CREATE TABLE `aaaa` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`text` varchar(100),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `aaaa` (`text`) VALUES (NULL);
ALTER TABLE `aaaa` CHANGE `text` `text` TEXT NOT NULL;
It fails when trying on MySQL 5.5 on Windows 7 with error "Data truncated for column 'text' at row 1" but works on MySQL 5.5 on Debian.
Why is the behaviour different?
Upvotes: 0
Views: 546
Reputation: 92795
I see consistent behavior both on Windows
mysql> ALTER TABLE `aaaa` CHANGE `text` `text` TEXT NOT NULL; ERROR 1265 (01000): Data truncated for column 'text' at row 1
and on Mac OS X
mysql> ALTER TABLE `aaaa` CHANGE `text` `text` TEXT NOT NULL; ERROR 1265 (01000): Data truncated for column 'text' at row 1
In your case you may have different sql_mode
settings for Windows and Debian installations of MySQL.
Upvotes: 1