From: Martijn Tonies Date: February 16 2006 12:10pm Subject: Re: primary key List-Archive: http://lists.mysql.com/mysql/194934 Message-Id: <02e701c632f1$fd81b0c0$cd02a8c0@martijnws> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit 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