Pergunta

Can someone please tell me what's wrong with this table definition.
mysql version is 5.1.52-log

root@localhost spoolrdb> create table spoolqueue (
                             queue int,
                             idx bigint not null auto_increment,
                             status smallint,
                             querystring varchar(2048),
                             contenttype varchar(255),
                             characterencoding varchar(16),
                             body text,
                             primary key(queue,idx)
                             );
ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key
Foi útil?

Solução

This will apparently work with MyISAM as storage engine, not InnoDB, if you can live with that.

Another way to get it to work is if you swap places of queue and idx in the primary key declaration.

Outras dicas

You can also give idx its own key if you prefer to have queue first in the PK. Note the addition of the index(idx) line:

create temporary table spoolqueue (
    queue int,
    idx bigint not null auto_increment,
    status smallint,
    querystring varchar(2048),
    contenttype varchar(255),
    characterencoding varchar(16),
    body text,
    primary key(queue,idx),
    index(idx)
);

Try removing the queue field from the primary key. You can index the queue column if you want

Licenciado em: CC-BY-SA com atribuição
Não afiliado a dba.stackexchange
scroll top