Re: key lengths
On Wed, Mar 07, 2001 at 07:49:22AM -0600, Mike Thompson wrote: Yes, I've tries that here is the error I get. Your MySQL connection id is 247 to server version: 3.23.33 mysql CREATE TABLE foo( - id INT NOT NULL AUTO_INCREMENT, - name BLOB NOT NULL, - PRIMARY KEY(id), - UNIQUE(name(500)) - ); ERROR 1089: Incorrect sub part key. The used key part isn't a string or the used length is longer than the key part No key part can be greater than 255 in lenght. But multi-part keys can be longer (in total) than 255. Jeremy -- Jeremy D. Zawodny, [EMAIL PROTECTED] Technical Yahoo - Yahoo Finance Desk: (408) 328-7878Fax: (408) 530-5454 Cell: (408) 439-9951 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: key lengths
I have a similar problem indexing a TEXT field. I am trying to create a unique index on the first 1024 characters of a TEXT field: * mysql * Welcome to the MySQL monitor. Commands end with ; or \g. * Your MySQL connection id is 66 to server version: 3.23.32 * * CREATE TABLE abc ( * f1 TEXT NOT NULL, * f2 VARCHAR(20) NOT NULL, * f3 VARCHAR(20) NOT NULL, * f4 VARCHAR(20) NOT NULL, * f5 TEXT NOT NULL, * * # 255 works ok, 256 does not work. * INDEX (f1(256)) * ); * * ERROR 1089 at line 3: Incorrect sub part key. The used key part isn't a * string or the used length is longer than the key part According to the documentation, TEXT fields hold up to 2^16 characters, and I can find no documented limitation on index size. As it stands at present, I can only index the first 255 character, and manually check for a duplicate record before inserting a new record. David Robinson. --- From: Mike Thompson Date: Wed, 07 Mar 2001 07:49:22 -0600 Yes, I've tries that here is the error I get. Your MySQL connection id is 247 to server version: 3.23.33 mysql CREATE TABLE foo( - id INT NOT NULL AUTO_INCREMENT, - name BLOB NOT NULL, - PRIMARY KEY(id), - UNIQUE(name(500)) - ); ERROR 1089: Incorrect sub part key. The used key part isn't a string or the used length is longer than the key part Pat Sherrill wrote: BLOBS and TEXT columns used as indices require the length to be specifically enumerated. (Sec 7.26 of the manual) CREATE TABLE foo( id INT NOT NULL AUTO_INCREMENT, name BLOB NOT NULL, PRIMARY KEY(id), UNIQUE(name(500)) ); Pat... [EMAIL PROTECTED] - Original Message - From: "Mike Thompson" [EMAIL PROTECTED] To: "mysql" [EMAIL PROTECTED] Sent: Tuesday, March 06, 2001 1:51 PM Subject: key lengths How is key length for a table defined? It seems that the default is 255 bytes, but in the online docs it mentions 500 byte keys. I happen to have some very long case sensitive strings that I need to use as keys, but mysql complains when I try to create a table as such CREATE TABLE foo( id INT NOT NULL AUTO_INCREMENT, name BLOB NOT NULL, PRIMARY KEY(id), UNIQUE(name) ); Any thoughts? --m - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- Michael R. ThompsonInstanton Corporation Sr. Software Developer 1250 Capital of Texas Highway South [EMAIL PROTECTED] Building 3 suite 200 328-1022x15Austin, TX 78746 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: key lengths
BLOBS and TEXT columns used as indices require the length to be specifically enumerated. (Sec 7.26 of the manual) CREATE TABLE foo( id INT NOT NULL AUTO_INCREMENT, name BLOB NOT NULL, PRIMARY KEY(id), UNIQUE(name(500)) ); Pat... [EMAIL PROTECTED] - Original Message - From: "Mike Thompson" [EMAIL PROTECTED] To: "mysql" [EMAIL PROTECTED] Sent: Tuesday, March 06, 2001 1:51 PM Subject: key lengths How is key length for a table defined? It seems that the default is 255 bytes, but in the online docs it mentions 500 byte keys. I happen to have some very long case sensitive strings that I need to use as keys, but mysql complains when I try to create a table as such CREATE TABLE foo( id INT NOT NULL AUTO_INCREMENT, name BLOB NOT NULL, PRIMARY KEY(id), UNIQUE(name) ); Any thoughts? --m - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: key lengths
Yes, I've tries that here is the error I get. Your MySQL connection id is 247 to server version: 3.23.33 mysql CREATE TABLE foo( - id INT NOT NULL AUTO_INCREMENT, - name BLOB NOT NULL, - PRIMARY KEY(id), - UNIQUE(name(500)) - ); ERROR 1089: Incorrect sub part key. The used key part isn't a string or the used length is longer than the key part Pat Sherrill wrote: BLOBS and TEXT columns used as indices require the length to be specifically enumerated. (Sec 7.26 of the manual) CREATE TABLE foo( id INT NOT NULL AUTO_INCREMENT, name BLOB NOT NULL, PRIMARY KEY(id), UNIQUE(name(500)) ); Pat... [EMAIL PROTECTED] - Original Message - From: "Mike Thompson" [EMAIL PROTECTED] To: "mysql" [EMAIL PROTECTED] Sent: Tuesday, March 06, 2001 1:51 PM Subject: key lengths How is key length for a table defined? It seems that the default is 255 bytes, but in the online docs it mentions 500 byte keys. I happen to have some very long case sensitive strings that I need to use as keys, but mysql complains when I try to create a table as such CREATE TABLE foo( id INT NOT NULL AUTO_INCREMENT, name BLOB NOT NULL, PRIMARY KEY(id), UNIQUE(name) ); Any thoughts? --m - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- Michael R. ThompsonInstanton Corporation Sr. Software Developer 1250 Capital of Texas Highway South [EMAIL PROTECTED] Building 3 suite 200 328-1022x15Austin, TX 78746 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php