Hi there,

> Im trying to set up a primary key of server(text), date (date), hour 
> (small int) but when i try to include the server field in the key it 
> replies with
> 
> ALTER TABLE `exim` DROP PRIMARY KEY ,
> ADD PRIMARY KEY ( `date` , `hour` , `server` )
> 
> #1170 - BLOB/TEXT column 'server' used in key specification without a 
> key length
> 
> i have googled, but not much is relevant to my example i dont think..

Well, you could start with the documentation.

"server" apparently, is a blob-type column. 

Lo and behold, the table definition:
 
> CREATE TABLE `exim` (
>    `date` date NOT NULL default '0000-00-00',
>    `server` longtext NOT NULL,

Yep. A BLOB column. Why, I wonder.

Either way - check the error message, read it. From what I can read
from it - and the MySQL documentation - you cannot "just" create
a constraint/index on a BLOB column.

>    `hour` tinyint(4) NOT NULL default '0',
>    `count` smallint(6) NOT NULL default '0',
>    PRIMARY KEY  (`date`,`hour`),
> ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='exim realtime stats';

Martijn Tonies
Database Workbench - development tool for MySQL, and more!
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com

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

Reply via email to