Hi!
>>>>> "Sasha" == Sasha Pachev <sasha@stripped> writes:
Sasha> Peter Zaitsev wrote:
>>
>> Hello mysql,
>>
>> Running Solaris 2.6 but I do not think this will affect anything.
>>
>> CREATE TABLE group_lang (
>> GROUP_ID int(10) unsigned DEFAULT '0' NOT NULL,
>> LANG_ID smallint(5) unsigned DEFAULT '0' NOT NULL,
>> NAME varchar(80) DEFAULT '' NOT NULL,
>> PRIMARY KEY (GROUP_ID,LANG_ID),
>> KEY NAME (NAME)
>> );
>>
>> ALTER TABLE group_lang CHANGE NAME NAME CHAR (80) not null
>>
>> After this the field NAME still have varchar TYPE !!!
>>
>> --
>> Best regards,
>> Peter mailto:pz@stripped
>>
Sasha> Ok, the problem here is that in order of alter table to force a varchar
Sasha> back into char this would require a full table re-organization, as you
Sasha> will be switching from variable length to fixed length record -- for
Sasha> some reason mysqld does not want to work that hard, and I can understand
Sasha> it, because I am just as lazy myself :-)
No this can't be the case; ALTER TABLE does always a full copy of the
table.
Sasha> Now whether this is a bug or a feature, let's ask Monty what he thinks.
It's a bug; The problem was that MySQL 3.23 tried a little to hard to
remember if you used ROW_TYPE=dynamic when you created the table.
Here is a patch for this:
*** /my/monty/master/mysql-3.23.8-alpha/sql/sql_table.cc Sun Dec 26 02:34:36 1999
--- ./sql_table.cc Wed Jan 12 01:42:51 2000
***************
*** 972,978 ****
if (!create_info->comment)
create_info->comment=table->comment;
/* let new create options override the old ones */
! db_create_options=table->db_create_options;
if (create_info->table_options &
(HA_OPTION_PACK_KEYS | HA_OPTION_NO_PACK_KEYS))
db_create_options&= ~(HA_OPTION_PACK_KEYS | HA_OPTION_NO_PACK_KEYS);
--- 972,978 ----
if (!create_info->comment)
create_info->comment=table->comment;
/* let new create options override the old ones */
! db_create_options=table->db_create_options & ~(HA_OPTION_PACK_RECORD);
if (create_info->table_options &
(HA_OPTION_PACK_KEYS | HA_OPTION_NO_PACK_KEYS))
db_create_options&= ~(HA_OPTION_PACK_KEYS | HA_OPTION_NO_PACK_KEYS);
Regards,
Monty