Bug #29757 | STRING FUNCTIONS WITH LIMITS | ||
---|---|---|---|
Submitted: | 12 Jul 2007 13:56 | Modified: | 1 Nov 2011 12:14 |
Reporter: | Roberto Spadim (Basic Quality Contributor) | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S3 (Non-critical) |
Version: | 5.5 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | qc |
[12 Jul 2007 13:56]
Roberto Spadim
[12 Jul 2007 14:01]
Roberto Spadim
i was checking and only variable that have this values is MAX_ALLOWED_PACKET is it limiting my max length?
[12 Jul 2007 14:04]
Roberto Spadim
on 64 bits machine: set MAX_ALLOWED_PACKET=4096128; select length(repeat('a',4096001)) this return 0 length it's very strange since if i change MAX_ALLOWED_PACKET=4096128; to MAX_ALLOWED_PACKET=4096129; the same error continue, only with 4097024 the function return ok
[12 Jul 2007 14:14]
MySQL Verification Team
Thank you for the bug report. What is the output you got? I got the below with --max_allowed_packet=16M on Windows 64-bit. c:\dev\5.1>bin\mysql -uroot Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.1.21-beta-nt Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> select -> length(repeat('a',2096128)), -> length(substring( repeat('a',2096128) ,1,2096128) ); +-----------------------------+-------------------------------------------------------+ | length(repeat('a',2096128)) | length(substring( repeat('a',2096128) ,1,2096128) ) | +-----------------------------+-------------------------------------------------------+ | 2096128 | 2096128 | +-----------------------------+-------------------------------------------------------+ 1 row in set (0.06 sec) mysql> select -> length(repeat('a',2096129)), -> length(substring( repeat('a',2096128) ,1,2096129) ); +-----------------------------+-------------------------------------------------------+ | length(repeat('a',2096129)) | length(substring( repeat('a',2096128) ,1,2096129) ) | +-----------------------------+-------------------------------------------------------+ | 2096129 | 2096128 | +-----------------------------+-------------------------------------------------------+ 1 row in set (0.06 sec)
[12 Jul 2007 18:06]
Roberto Spadim
i found the problem, max_allowed_packet set the max length for strings, i think that's wrong, since i'm returning LENGTH( very big string ), and the length() result just have about 10 bytes (if it's a string, maybe less if you send it as integer of 4 bytes) manual should show this limit of string functions you windows-64bits works ok on 32-bits too, the problem is the variable that's small to return a length() function of 10 bytes
[13 Jul 2007 6:35]
Sveta Smirnova
Thank you for the report. Verified as described: =====mysql-5.1===== =====bug29757===== select length(repeat('a',2096129)), length(substring( repeat('a',2096128) ,1,2096129) ); length(repeat('a',2096129)) length(substring( repeat('a',2096128) ,1,2096129) ) NULL NULL Warnings: Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
[21 Mar 2011 4:10]
Roberto Spadim
any work log? any bug closed? it's working with newers versions?
[5 Apr 2011 6:06]
Roberto Spadim
don't work with mysql 5.5 maybe internal functions (not mysql result) could be executed with more memory limit, and mysql result should execute with max_allowed_packet
[1 Nov 2011 4:48]
Roel Van de Paar
Bug#42680 has been made a duplicate of this one. Please review as needed.
[1 Nov 2011 12:14]
Roberto Spadim
nice, could we add another variable ? for example string could make work internally with > max_allowed_packet and return a small value to user? i don[t know how mysql internally do this, but could this work? or add some info at documents about string functions limits? the duplicate is nice for me, i think that's the same problem