MySQL Forums
Forum List  »  Delphi

I set a text datatype, mysql says 'mediumText'
Posted by: Frederick C. Lee
Date: December 19, 2006 12:05PM

My Environment:
[/Users/Ric]mysql --version
mysql Ver 14.13 Distrib 5.1.14-beta, for apple-darwin8.6.0 (powerpc) using readline 5.0


1) I create a table. The 'dom' column was set to be a varchar(64000):
mysql> CREATE TABLE `psControl` (
    ->   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    ->   `ccode` varchar(5) NOT NULL DEFAULT '',
    ->   `pcode` varchar(5) NOT NULL DEFAULT '',
    ->   `edition` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    ->   `description` varchar(200) DEFAULT NULL,
    ->   `dom` varchar(64000),
    ->   PRIMARY KEY (`id`)
    -> ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
Query OK, 0 rows affected, 1 warning (0.09 sec)

What I get is:
mysql> desc psControl;
+-------------+------------------+------+-----+-------------------+----------------+
| Field       | Type             | Null | Key | Default           | Extra          |
+-------------+------------------+------+-----+-------------------+----------------+
| id          | int(10) unsigned | NO   | PRI | NULL              | auto_increment | 
| ccode       | varchar(5)       | NO   |     |                   |                | 
| pcode       | varchar(5)       | NO   |     |                   |                | 
| edition     | timestamp        | NO   |     | CURRENT_TIMESTAMP |                | 
| description | varchar(200)     | YES  |     | NULL              |                | 
| dom         | mediumtext       | YES  |     | NULL              |                | 
+-------------+------------------+------+-----+-------------------+----------------+
6 rows in set (0.08 sec)

As you can see, the column 'dom' ALWAYS get set to 'mediumText'.

Now, if I create a very simple table, say "burp", it works:

mysql> create table burp (dom varchar(64000));
Query OK, 0 rows affected (0.10 sec)

mysql> desc burp;
+-------+----------------+------+-----+---------+-------+
| Field | Type           | Null | Key | Default | Extra |
+-------+----------------+------+-----+---------+-------+
| dom   | varchar(64000) | YES  |     | NULL    |       | 
+-------+----------------+------+-----+---------+-------+
1 row in set (0.09 sec)

By the way, if I were to use the datatype 'longtext' for the 'dom', it works too:

mysql> CREATE TABLE `psControl` (
    ->   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    ->   `ccode` varchar(5) NOT NULL DEFAULT '',
    ->   `pcode` varchar(5) NOT NULL DEFAULT '',
    ->   `edition` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    ->   `description` varchar(200) DEFAULT NULL,
    ->   `dom` longtext,
    ->   PRIMARY KEY (`id`)
    -> ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.09 sec)

mysql> desc psControl;
+-------------+------------------+------+-----+-------------------+----------------+
| Field       | Type             | Null | Key | Default           | Extra          |
+-------------+------------------+------+-----+-------------------+----------------+
| id          | int(10) unsigned | NO   | PRI | NULL              | auto_increment | 
| ccode       | varchar(5)       | NO   |     |                   |                | 
| pcode       | varchar(5)       | NO   |     |                   |                | 
| edition     | timestamp        | NO   |     | CURRENT_TIMESTAMP |                | 
| description | varchar(200)     | YES  |     | NULL              |                | 
| dom         | longtext         | YES  |     | NULL              |                | 
+-------------+------------------+------+-----+-------------------+----------------+
6 rows in set (0.08 sec)

Any reason for this?

Ric.

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"

Options: ReplyQuote


Subject
Written By
Posted
I set a text datatype, mysql says 'mediumText'
December 19, 2006 12:05PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.