At 01:02 AM 3/13/2002, you wrote:
>Greetings!!!
>
>I would just like to know if the following is normal:
>
>I created a file TRANSACTION_LOG.sql to create an InnoDB table with MULTIPLE
>KEYs with one AUTO COLUMN.
>
>The file consists of the following SQL commands:
>
>drop table TRANSACTION_LOG;
>create table TRANSACTION_LOG (SESSION_ID int(10) not null, TRANS_CODE int(5)
>not null, TRANS_LOG_ID int(10) not null auto_increment, primary key
>(TRANS_CODE,TRANS_LOG_ID)) TYPE = InnoDB;
>
>Unfortunately , I get the following error:
>
>
>[root@oracle /root]# mysql accounting < TRANSACTION_LOG.sql
>ERROR 1075 at line 2: Incorrect table definition; There can only be one auto
>column and it must be defined as a key
>
>Does InnoDB tables support MULTIPLE KEYS with an AUTO COlumn?

Edgar,
         Not officially.   The InnoDb manual states auto-increment fields 
must be in a key by themselves. :-(

         But I've discovered you can have a compound index with an 
auto-increment field as long as the auto-increment field is the *first* 
field of the index. So if you switch your primary key to

primary key (TRANS_LOG_ID,TRANS_CODE)

it should work. :-)

Brent


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to