hugowan / maatkit

Automatically exported from code.google.com/p/maatkit
0 stars 0 forks source link

Test schema changes in 5.1 #109

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Ronald Bradford tells me that 5.1 has case differences in SHOW CREATE TABLE:

26,27c43,44
<   `_id` int(15) NOT NULL AUTO_INCREMENT,
<   `_acquired` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
CURRENT_TIMESTAMP,

---
>   `_id` int(15) NOT NULL auto_increment,
>   `_acquired` timestamp NOT NULL default CURRENT_TIMESTAMP on update
CURRENT_TIMESTAMP,

Test that this doesn't screw up TableParser.pm.

Original issue reported on code.google.com by baron.schwartz on 23 Oct 2008 at 10:50

GoogleCodeExporter commented 9 years ago
I'm testing this.

Original comment by dan...@percona.com on 25 Oct 2008 at 6:18

GoogleCodeExporter commented 9 years ago
Indeed, for example in 5.0.51:
| city  | CREATE TABLE `city` (
  `city_id` smallint(5) unsigned NOT NULL auto_increment,
  `city` varchar(50) NOT NULL,
  `country_id` smallint(5) unsigned NOT NULL,
  `last_update` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,

But in 5.1.28:
| city  | CREATE TABLE `city` (
  `city_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  `city` varchar(50) NOT NULL,
  `country_id` smallint(5) unsigned NOT NULL,
  `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

Original comment by dan...@percona.com on 25 Oct 2008 at 6:45

GoogleCodeExporter commented 9 years ago
TableParser should be fine. I tested this in r2452 and it works. I looked 
through the
code and it's pretty agnostic as concerns the specifics of a given table def. 
This line:
$is_autoinc{$col} = $def =~ m/AUTO_INCREMENT/i ? 1 : 0; 
would have been a problem, but as we can see: it's case-insensitive.

There's a sub in the test file that will allow us to easily add more tests 
later if
we need.

Original comment by dan...@percona.com on 25 Oct 2008 at 8:41