On Sat, Aug 13, 2005 at 04:01:38PM +0100, Pooly wrote:
> 
> ALTER TABLE sessions MODIFY ip char(8) NOT NULL DEFAULT '0';
> ALTER TABLE sessions MODIFY id char(32) NOT NULL DEFAULT '';

Hello,

Since you have two varchar columns, I don't think there's any way to
convert them both to char without dropping one first.

MySQL will always silently convert a char into a varchar if the table
is already a dynamic-row-length type (which it is, because the other
varchar makes it that way). So neither statement actually does
anything, they're both null operations.

The only way you can do this would be to move all data from, say, ip,
into another table temporarily, then drop that column, then change id
into a char, then create ip as a char, and import it all back.

This reveals a bit of a shortcoming in alter table that you can't
atomically modify two columns at once, which might get around this
problem.

-- 
Chris

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to