Below is the list of changes that have just been committed into a local
4.1 repository of jimw. When jimw does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2340 05/07/22 11:46:29 jimw@stripped +3 -0
Fix calculation for length of LPAD() and RPAD() reported to
client via mysql_fetch_fields(). (Bug #11311)
sql/item_strfunc.cc
1.233 05/07/22 11:46:25 jimw@stripped +0 -2
Fix length reported for LPAD() and RPAD() -- they always truncate to the
length that is given.
mysql-test/t/func_str.test
1.77 05/07/22 11:46:25 jimw@stripped +11 -0
Add new regression test
mysql-test/r/func_str.result
1.96 05/07/22 11:46:25 jimw@stripped +15 -0
Add new results
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: jimw
# Host: rama.(none)
# Root: /home/jimw/my/mysql-4.1-11311
--- 1.232/sql/item_strfunc.cc 2005-07-19 09:24:59 -07:00
+++ 1.233/sql/item_strfunc.cc 2005-07-22 11:46:25 -07:00
@@ -2042,7 +2042,6 @@
{
ulonglong length= ((ulonglong) args[1]->val_int() *
collation.collation->mbmaxlen);
- length= max((ulonglong) args[0]->max_length, length);
if (length >= MAX_BLOB_WIDTH)
{
length= MAX_BLOB_WIDTH;
@@ -2130,7 +2129,6 @@
{
ulonglong length= ((ulonglong) args[1]->val_int() *
collation.collation->mbmaxlen);
- length= max((ulonglong) args[0]->max_length, length);
if (length >= MAX_BLOB_WIDTH)
{
length= MAX_BLOB_WIDTH;
--- 1.95/mysql-test/r/func_str.result 2005-07-13 02:22:28 -07:00
+++ 1.96/mysql-test/r/func_str.result 2005-07-22 11:46:25 -07:00
@@ -868,3 +868,18 @@
select hex(29223372036854775809), hex(-29223372036854775809);
hex(29223372036854775809) hex(-29223372036854775809)
FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF
+create table t1 (i int);
+insert into t1 values (1000000000),(1);
+select lpad(i, 7, ' ') as t from t1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max
length Is_null Flags Decimals Charsetnr
+def t 253 7 7 Y 128 31 63
+t
+1000000
+ 1
+select rpad(i, 7, ' ') as t from t1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max
length Is_null Flags Decimals Charsetnr
+def t 253 7 7 Y 128 31 63
+t
+1000000
+1
+drop table t1;
--- 1.76/mysql-test/t/func_str.test 2005-07-13 02:22:28 -07:00
+++ 1.77/mysql-test/t/func_str.test 2005-07-22 11:46:25 -07:00
@@ -611,3 +611,14 @@
# Bug #9854 hex() and out of range handling
#
select hex(29223372036854775809), hex(-29223372036854775809);
+
+#
+# Bug #11311: Incorrect length returned from LPAD() and RPAD()
+#
+create table t1 (i int);
+insert into t1 values (1000000000),(1);
+--enable_metadata
+select lpad(i, 7, ' ') as t from t1;
+select rpad(i, 7, ' ') as t from t1;
+--disable_metadata
+drop table t1;
| Thread |
|---|
| • bk commit into 4.1 tree (jimw:1.2340) BUG#11311 | Jim Winstead | 22 Jul |