[plug] auto-increment in mysql

James Bromberger james at rcpt.to
Wed Jan 1 21:46:32 WST 2003


Craig Ringer (craig at postnewspapers.com.au) wrote:
> ALTER TABLE tablename ADD COLUMN colname TYPENAME AUTO_INCREMENT;
> 
> thats the general idea, anyway. I mainly use postgresql these days so I 
> may be a bit rusty. Hmm... when I tried it the db said:
> 
> mysql> ALTER TABLE test ADD COLUMN testing int AUTO_INCREMENT;
> ERROR 1075: Incorrect table definition; There can only be one auto 
> column and it must be defined as a key


 mysql> ALTER TABLE test ADD COLUMN testing int PRIMARY KEY AUTO_INCREMENT;


But "there can be only one"... primary key per table (hence the name
'primary', and thus there can be only one auto_increment). ut I am sure
that mysql 4 is a whole new world, just bursting to get out of
Debian/experimental into debian/unstable.... at some time...


   JB

PS: All you PLUGers and lurkers who are thinking about registering for
LCA; hurry up and DO IT! It's only 2 and a bit weeks away! Hurry up! 
http://www.linux.conf.au/

-- 
 James Bromberger <james_AT_rcpt.to> www.james.rcpt.to
 Remainder moved to http://www.james.rcpt.to/james/sig.html
 The Australian Linux Technical Conference 2003: http://www.linux.conf.au/

I am moving to London on January 27th, arriving London January 28th. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.plug.org.au/pipermail/plug/attachments/20030101/b82408f9/attachment.pgp>


More information about the plug mailing list