List:General Discussion« Previous MessageNext Message »
From:Ferindo Middleton Jr Date:November 22 2005 3:49am
Subject:UNIQUE constraint, proper use
View as plain text  
I have this SQL statement:

CREATE TABLE rooms (
                         id                SERIAL,
                         room_name       TEXT UNIQUE,
                         location      TEXT,
                         last_updated  TIMESTAMP DEFAULT 
CURRENT_TIMESTAMP NOT NULL,
                         last_user_updated    TEXT,
             PRIMARY KEY(id)
);

When I run this I get the following error:
ERROR 1170 (42000): BLOB/TEXT column 'room_name' used in key 
specification without a key length

I'm more used to PostgreSQL and when I run this command there, I don't 
get this error message. I recognized that by changing room_name to a 
varchar type, I won't get the error message.

Also, the PostgreSQL mailing lists had a special group from SQL-related 
issue, but I didn't see one of these types of lists in the lists of 
groups for MySQL community so I'm sorry if I irritate anyone by posting 
to the wrong group. Thanks.

Ferindo Middleton
Thread
UNIQUE constraint, proper useFerindo Middleton Jr22 Nov
  • Re: UNIQUE constraint, proper usePaul DuBois22 Nov
  • Re: UNIQUE constraint, proper useHarald Fuchs22 Nov
  • Re: UNIQUE constraint, proper useMartijn Tonies22 Nov