Description:
CREATE INDEX fails with and error:
CREATE TABLE user (ukey INT NOT NULL AUTO_INCREMENT,username VARCHAR(16),password CHAR(16) NOT NULL, PRIMARY KEY(ukey));
CREATE INDEX user_username ON user(username);
Results in:
mysql> CREATE INDEX user_username ON user(username);
ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'user(username)' at line 1
It does this every time.
Output mysqlbug:
SEND-PR: -*- send-pr -*-
SEND-PR: Lines starting with `SEND-PR' will be removed automatically, as
SEND-PR: will all comments (text enclosed in `<' and `>').
SEND-PR:
From: root
To: mysql@lists.mysql.com
Subject: [50 character or so descriptive subject here (for reference)]
>Description:
<precise description of the problem (multiple lines)>
>How-To-Repeat:
<code/input/activities to reproduce the problem (multiple lines)>
>Fix:
<how to correct or work around the problem, if known (multiple lines)>
>Submitter-Id: <submitter ID>
>Originator: root
>Organization:
<organization of PR author (multiple lines)>
>MySQL support: [none | licence | email support | extended email support ]
>Synopsis: <synopsis of the problem (one line)>
>Severity: <[ non-critical | serious | critical ] (one line)>
>Priority: <[ low | medium | high ] (one line)>
>Category: mysql
>Class: <[ sw-bug | doc-bug | change-request | support ] (one line)>
>Release: mysql-4.1.0-alpha-standard (Official MySQL-standard binary)
>C compiler: 2.95.3
>C++ compiler: 2.95.3
>Environment:
<machine, os, target, libraries (multiple lines)>
System: Linux server 2.4.18-4GB #1 Wed Mar 27 13:56:33 UTC 2002 i586 unknown
Architecture: i586
Some paths: /usr/bin/perl /usr/bin/make /usr/bin/gmake /usr/bin/gcc /usr/bin/cc
GCC: Reading specs from /usr/lib/gcc-lib/i486-suse-linux/2.95.3/specs
gcc version 2.95.3 20010315 (SuSE)
Compilation info: CC='gcc' CFLAGS='-O2 -mcpu=pentiumpro' CXX='gcc' CXXFLAGS='-O2 -mcpu=pentiumpro -felide-constructors' LDFLAGS='' ASFLAGS=''
LIBC:
-rwxr-xr-x 1 root root 1394238 Jul 12 2002 /lib/libc.so.6
-rw-r--r-- 1 root root 25361424 Jul 12 2002 /usr/lib/libc.a
-rw-r--r-- 1 root root 178 Mar 23 2002 /usr/lib/libc.so
-rw-r--r-- 1 root root 869190 Mar 23 2002 /usr/lib/libc-client.a
lrwxrwxrwx 1 root root 20 Jul 4 2002 /usr/lib/libc-client.so -> libc-client.so.2001a
-rwxr-xr-x 1 root root 725296 Mar 23 2002 /usr/lib/libc-client.so.2001a
Configure command: ./configure '--prefix=/usr/local/mysql' '--with-comment=Official MySQL-standard binary' '--with-extra-charsets=complex' '--with-server-suffix=-standard' '--enable-thread-safe-client' '--enable-local-infile' '--enable-assembler' '--disable-shared' '--with-client-ldflags=-all-static' '--with-mysqld-ldflags=-all-static' '--with-innodb' 'CFLAGS=-O2 -mcpu=pentiumpro' 'CXXFLAGS=-O2 -mcpu=pentiumpro -felide-constructors' 'CXX=gcc'
How to repeat:
Use the CREATE INDEX on the already created table:
CREATE INDEX user_username ON user(username);
This wil result in:
mysql> CREATE INDEX user_username ON user(username);
ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'user(username)' at line 1
Suggested fix:
ALTER TABLE user ADD INDEX user_username(username);
Works good.