List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:October 6 1999 5:15pm
Subject:mysql daemon dies on 'alter table' with 'after' specifying last col
View as plain text  
>>>>> "greg" == greg webber <greg.webber@stripped> writes:

>> Description:
greg> If you attempt to execute an 'alter table' SQL statement that includes an
greg> 'add column' together with an 'after col_name' where col_name is the last
greg> column (in which case there was no point putting it there anyway with the
greg> current behaviour of 'add column' which puts it at the end), the server
greg> dies.

greg> In addition one process is left hanging around which must be manually killed
greg> before the server can be brought up again via the init.d script.  You'll see
greg> (part of the reason) why when you try to pull it down using the init.d
greg> (missing files in /var/lib/mysql).

>> How-To-Repeat:
greg> create database temp;
greg> use temp;

greg> #this table is from my app (with renamed cols)
greg> create table mytable (
greg> col1 int not null auto_increment primary key,
greg> col2 varchar(30) not null,
greg> col3 varchar (20) not null,
greg> col4 varchar(4) not null,
greg> col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
greg> col6 int not null);

greg> #this is the change I attempt to make
greg> alter table mytable
greg> add column col4_5 varchar(20) not null after col4,
greg> add column col7 varchar(30) not null after col6,
greg> add column col8 datetime not null;

>> Fix:
greg> If the column specified together with 'after' is the last (right-most) column,
greg> then omit it since it will be placed there anyway in the absence of any other
greg> directives.

Hi!

Fix:

(/my/monty/sql) diff -c /my/monty/master/mysql-3.23.4-alpha/sql/sql_list.h .
*** /my/monty/master/mysql-3.23.4-alpha/sql/sql_list.h  Mon Aug 30 00:03:08 1999
--- ./sql_list.h        Wed Oct  6 20:10:48 1999
***************
*** 111,116 ****
--- 111,118 ----
      list_node *new_node=new list_node(info,node->next);
      node->next=new_node;
      elements++;
+     if (last == &(node->next))
+       last= &new_node->next;
    }
  };

Regards,
Monty
Thread
mysql daemon dies on 'alter table' with 'after' specifying last colgreg.webber4 Oct
  • mysql daemon dies on 'alter table' with 'after' specifying last colMichael Widenius6 Oct