Bug #38434 unique key index length
| Submitted: | 29 Jul 2008 19:15 | Modified: | 6 Aug 2008 15:50 |
|---|---|---|---|
| Reporter: | Sanjeev Kumar | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: DDL | Severity: | S1 (Critical) |
| Version: | 5.0.51b-community-nt MySQL Community Ed, 5.0, 5.1 BZR | OS: | Any (Linux, MS Windows xp) |
| Assigned to: | Assigned Account | CPU Architecture: | Any |
[29 Jul 2008 19:15]
Sanjeev Kumar
[29 Jul 2008 19:18]
Sanjeev Kumar
Insert query should be : INSERT INTO testtable(BATCH_GID, MEDIA_GID, METADATA_GID, METADATA_VALUE, ELIM_REASON, ELIM_COUNT, ELIM_SIZE) VALUES(1, 1, 1, 'this is test-metadat-value', 'this test-elim-reason-value', 1, 1) ON DUPLICATE KEY UPDATE ELIM_COUNT = VALUES(ELIM_COUNT), ELIM_SIZE = VALUES(ELIM_SIZE);
[29 Jul 2008 19:59]
Sveta Smirnova
Thank you for the report. Please provide query you use to "update the index to the unique key"
[29 Jul 2008 20:20]
Sanjeev Kumar
It is actually dropping the index key first then creating unique key. ALTER TABLE `testtable` DROP INDEX `UNIQUE_KEY`, ADD INDEX UIQUE_KEY(`BATCH_GID`, `MEDIA_GID`, `METADATA_GID`, `METADATA_VALUE`, `ELIM_REASON`); Warning: Specified key was too long; max key length is 765 bytes Warning: Specified key was too long; max key length is 765 bytes ALTER TABLE `testtable` DROP INDEX `UNIQUE_KEY`, ADD UNIQUE `UNIQUE_KEY`(`BATCH_GID`, `MEDIA_GID`, `METADATA_GID`, `METADATA_VALUE`(255), `ELIM_REASON`(255));
[29 Jul 2008 20:30]
Sveta Smirnova
Thanl you for the feedback. > ALTER TABLE `testtable` DROP INDEX `UNIQUE_KEY`, > ADD UNIQUE `UNIQUE_KEY`(`BATCH_GID`, `MEDIA_GID`, `METADATA_GID`, > `METADATA_VALUE`(255), `ELIM_REASON`(255)); You specified length of METADATA_VALUE and ELIM_REASON, so actual length of unique key is 255 + 255 + 4 + 4 + 4 = 522 < 767 So I close this report as not a bug.
[29 Jul 2008 20:34]
Sanjeev Kumar
But these two columns are having utf-8 encoding so so shouldn't be it is 255*3 + 255*3 + 4 + 4 + 4
[30 Jul 2008 16:03]
Sveta Smirnova
Thank you for the feedback. Set to "Verified".
[6 Aug 2008 15:50]
Sanjeev Kumar
Any updates on this? Does status verified means this is not bug or this has been verified as a bug? Thanks, Sanjeev
[6 Aug 2008 17:55]
Sveta Smirnova
"Verified" means the report is considered as valid bug and will be processed.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.058 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.