Questions tagged [mysql-error-1170]

BLOB/TEXT column '%s' used in key specification without a key length

BLOB/TEXT column '%s' used in key specification without a key length

14 questions
499
votes
20 answers

MySQL error: key specification without a key length

I have a table with a primary key that is a varchar(255). Some cases have arisen where 255 characters isn't enough. I tried changing the field to a text, but I get the following error: BLOB/TEXT column 'message_id' used in key specification without…
GSto
  • 41,512
  • 37
  • 133
  • 184
7
votes
2 answers

MySQL Fulltext index with Rails 2.3.2 (migration problem)

I'm using MySQL fulltext indexes in a Rails 2.3.2 App. I added the index via native SQL in my migration. But there is a known issue causing problems with the schema.rb. Rails doesn't understand fulltext indexes and tries to create a normal index.…
Ole Spaarmann
  • 15,845
  • 27
  • 98
  • 160
7
votes
2 answers

Mapping a @Lob valued Map

This is part of my model: @Entity public class Entry { @Id @GeneratedValue private long identifier; @ElementCollection @Column(nullable = false) private Map titles; @ElementCollection @Column(nullable =…
Panayiotis Karabassis
  • 2,278
  • 3
  • 25
  • 40
6
votes
1 answer

@IdClass with non primative @Id

I'm trying to add a composite primary key to a class and having a bit of trouble. Here are the classes. class User { private long id; ... } class Token { private User user; private String series; ... } I'm using the orm.xml to…
user209627
5
votes
3 answers

MySQL: How to alter varchar(255) UNIQUE column to UNIQUE Text NOT NULL?

The current column is a VARCHAR(255) NOT NULL, so how do I change it to TEXT NOT NULL? NOTE: The column intended to be changed its property type is a UNIQUE KEY combination of another column. E.g. UNIQUE KEY (Name, Description) The column…
George Leow
  • 2,193
  • 6
  • 23
  • 27
2
votes
2 answers

Problem in using TEXT field in mysql Table

This is very straight problem but I haven't figured out any solution yet. Scenario is I have 2 table in my DB. Source of 2nd table is dependent on 1st table's SOURCE_URL(can be more than 255 char so I have used TEXT). create table SOURCES ( …
user760955
2
votes
2 answers

Applying an Index to a Blob/Longtext field

I am trying to create an index on a particular text string using Hibernate annotations. What I am currently doing is: @Index(name="guid_index") @Column(length=1400) private String myGUID; However, since the length of the column is 1400, this maps…
VeeArr
  • 6,039
  • 3
  • 24
  • 45
2
votes
2 answers

Error creating spatial index on MySql BLOB column

I am trying to add a spatial index to a table column named Location of type BLOB. If I try this: ALTER TABLE route ADD SPATIAL INDEX(Location); I get: Error: BLOB/TEXT column 'Location' used in key specification without a key length But in…
James Allen
  • 6,406
  • 8
  • 50
  • 83
1
vote
1 answer

Hibernate @Index error on long string columns

I have a data model where I need a String column to be indexed by the backing database: @Entity public class A { // ... @Column(length=2048) @Index(name="strFieldIndex") private String strField; } When adding the length attribute…
Johan Sjöberg
  • 47,929
  • 21
  • 130
  • 148
1
vote
2 answers

What are the hibernate annotations used to persist a Map with an enumerated type as a key?

I am having trouble getting the right hibernate annotations to use on a Map with an enumerated class as a key. Here is a simplified (and extremely contrived) example. public class Thing { public String id; public Letter startLetter; …
Jason Novak
  • 1,081
  • 3
  • 13
  • 26
1
vote
1 answer

Errors creating generic relations using content types (object_pk)

I am working to use django's ContentType framework to create some generic relations for a my models; after looking at how the django developers do it at django.contrib.comments.models I thought I would imitate their approach/conventions: from…
thornomad
  • 6,707
  • 10
  • 53
  • 78
0
votes
4 answers

MySQL: How to make data unique for several rows in a table?

How would I do the following (interested only in how to do UNIQUE (title, description)) in phpMyAdmin?: CREATE TABLE `myData` ( id serial primary key, title varchar(255) not null, description varchar(255) not null, UNIQUE (title,…
AleGore
  • 293
  • 1
  • 4
  • 11
0
votes
1 answer

Unable to create column in MySQL database with datatype of TEXT

I'm creating a table to hold items from rss feeds and I need to create a column 'description'. I selected the datatype as TEXT with no limit set with no index on this column. This is the error I'm getting: #1071 - Specified key was too long; max key…
Kylee
  • 1,625
  • 1
  • 31
  • 54
0
votes
1 answer

syntax for trigger before insert

Ok, so I see that this the wrong approach: mysql> mysql> show tables; +---------------------+ | Tables_in_nntp | +---------------------+ | articles | | newsgroups | | newsgroups_articles | +---------------------+ 3 rows in…
Thufir
  • 8,216
  • 28
  • 125
  • 273