I am using MySQL 5.0.2 on a Redhat 9 box.  I am having problems altering
some columns default value and having it show up in the 'show create
table x' and backup files.  Here is my repeatable example:

 

I issue this create statement:

create table mytable (

a int not null,

b int not null,

c int

);

 

Then I issue this alter table statement:

alter table mytable

alter a set default '1';

 

Then I issue:

Show create table mytable;

 

The result is:

CREATE TABLE `mytable` (

  `a` int(11) NOT NULL,

  `b` int(11) NOT NULL,

  `c` int(11) default NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1

 

However, the behavior works properly.

For instance:

insert into mytable (b, c) values (2, 3);

select * from mytable;

 

produces:

1, 2, 3

 

I realize of course that I can simply put the default value clause in my
create statement, but I don't want to do that because the entire
database has already been established and is up and running in a
production environment.

Am I doing something wrong or is this a bug?  Whatever the case, what is
the fix?

 

Thank you,

 

Jason McAffee

The Technology Group

Reply via email to