Page 2 of 2

Re: Question on MySQL database structure: Why 3 MyISAM table

Posted: 10 Sep 2013, 12:12
by AngryChris
I would guess if the table is already InnoDB and you do the ALTER TABLE on it to set InnoDB, it will just pop an error. I can't imagine it would break anything.

Re: Question on MySQL database structure: Why 3 MyISAM table

Posted: 10 Sep 2013, 12:21
by fox
Error in db update script would cause an update failure though.

Re: Question on MySQL database structure: Why 3 MyISAM table

Posted: 10 Sep 2013, 14:55
by sleeper_service
can you test for the db type before that update step? or just ignore an error at that stage?

Re: Question on MySQL database structure: Why 3 MyISAM table

Posted: 10 Sep 2013, 15:08
by fox
That would need a special update kinda thing, generic updater checks for every query result and aborts with whining if something goes wrong (and rollbacks the transaction but in mysql case this might matter little).

Re: Question on MySQL database structure: Why 3 MyISAM table

Posted: 10 Sep 2013, 15:57
by dxbi
It doesn't give an error in any case:

Code: Select all

mysql> SELECT TABLE_NAME, ENGINE FROM information_schema.TABLES WHERE TABLE_NAME='foo';
+------------+--------+
| TABLE_NAME | ENGINE |
+------------+--------+
| foo        | MyISAM |
+------------+--------+
1 row in set (0.00 sec)

mysql> ALTER TABLE `foo` ENGINE=InnoDB;
Query OK, 0 rows affected (0.15 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> SELECT TABLE_NAME, ENGINE FROM information_schema.TABLES WHERE TABLE_NAME='foo';
+------------+--------+
| TABLE_NAME | ENGINE |
+------------+--------+
| foo        | InnoDB |
+------------+--------+
1 row in set (0.00 sec)

mysql> ALTER TABLE `foo` ENGINE=InnoDB;
Query OK, 0 rows affected (0.23 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql>

Re: Question on MySQL database structure: Why 3 MyISAM table

Posted: 10 Sep 2013, 16:11
by sleeper_service
fox wrote:That would need a special update kinda thing, generic updater checks for every query result and aborts with whining if something goes wrong (and rollbacks the transaction but in mysql case this might matter little).
I was about to say "you're bright, you'll figure it out" but then dxbi rolls up and says it doesn't even matter.

I guess altering a db to a state it's already in isn't considered an error...

Re: Question on MySQL database structure: Why 3 MyISAM table

Posted: 10 Sep 2013, 16:59
by fox
Ah that's cool; I guess I can make an update script then.