0

I'm trying to create a table in a MariaDB database with following statement:

CREATE TABLE messages(id INT PRIMARY KEY AUTO_INCREMENT, message_id INT NOT NULL, message_text TEXT NOT NULL UNIQUE); 

but I get the following error:

ERROR 1170 (42000): BLOB/TEXT column 'message_text' used in key specification without a key length 

trying to specify the length for TEXT like TEXT(100) also results in the same error.

3
  • I can't replicate this behaviour. Commented May 10, 2016 at 13:56
  • @Strawberry sorry I missed the UNIQUE after TEXT in my table creation statement. Commented May 10, 2016 at 13:58
  • 1
    @Barracuda That's the critical bit. You can't have a UNIQUE on a TEXT column. See the dupe question. Commented May 10, 2016 at 13:59

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.