[vox-tech] Altering Columns in MySQL on RedHat

Jeff Newmiller vox-tech@lists.lugod.org
Tue, 2 Dec 2003 08:22:19 -0800 (PST)


On Mon, 1 Dec 2003, Marc Elliot Hall wrote:

> I've got a RedHat 8 box running MySQL 3.23.55. One of my tables has a 
> field with 'varchar(250)' as the data type.
> 
> mysql> desc foo;
> +-------------+--------------+------+-----+---------+----------------+
> | Field       | Type         | Null | Key | Default | Extra          |
> +-------------+--------------+------+-----+---------+----------------+
> | id          | int(11)      |      | UNI | NULL    | auto_increment |
> | sku         | varchar(10)  |      | PRI |         |                |
> | bar         | varchar(250) |      | MUL |         |                |
> | name        | text         | YES  |     | NULL    |                |
> | etc...      | int(11)      | YES  |     | NULL    |                |
> 
> 
> Unfortunately, 250 characters is insufficient for the data I want to put 
> into this field. So, I want to change it to 'blob' or 'text'. However, 
> when I use:

I think you should reconsider this from a design perspective... making a
very long field the primary key is inefficient in space (the primary key
index gets really big) and you have to specify all of those characters
when you want to find a specific record again.

I don't know whether MySQL can index BLOB fields anyway... most
DBMSs won't even allow you to try.

---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...2k
---------------------------------------------------------------------------