Miguel, all indexed columns must be explicitly declared NOT NULL.
You should do this:
ALTER TABLE users CHANGE alias alias <the current definition> NOT NULL;
For example, if the alias field is a CHAR(16), then you would do:
ALTER TABLE users CHANGE alias alias CHAR(16) NOT NULL;
CREATE UNIQUE INDEX alias_index ON USERS (alias);
In general, I think it's a good idea to declare all columns NOT
NULL unless you intend on using a NULL value. That way it will
keep you from making unintentional mistakes (which are very easy
to do with NULL values, and often very hard to track down).
Tim
On Tue, Apr 20, 1999 at 07:38:58PM -0100, Miguel Oliveira wrote:
> CREATE UNIQUE INDEX alias_index ON users(alias)
>
> Couldn't create the alias index on the users table! (Column 'alias' is
> used with UNIQUE or INDEX but is not defined as NOT NULL)