summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
authorSreeharsha Ramanavarapu <sreeharsha.ramanavarapu@oracle.com>2015-07-16 07:56:39 +0530
committerSreeharsha Ramanavarapu <sreeharsha.ramanavarapu@oracle.com>2015-07-16 07:56:39 +0530
commit888fabd6909237f55ed9b9cf7a0c852c2e5f0beb (patch)
tree9fcc3de2a441a39fc7c368f2a58ce1ebe5520711 /mysql-test/r
parente57e1b235ea0d0cc2e43017ebdccac34db369200 (diff)
downloadmariadb-git-888fabd6909237f55ed9b9cf7a0c852c2e5f0beb.tar.gz
Bug #21143080: UPDATE ON VARCHAR AND TEXT COLUMNS PRODUCE
INCORRECT RESULTS Issue: ----- Updating varchar and text fields in the same update statement can produce incorrect results. When a varchar field is assigned to the text field and the varchar field is then set to a different value, the text field's result contains the varchar field's new value. SOLUTION: --------- Currently the blob type does not allocate space for the string to be stored. Instead it contains a pointer to the varchar string. So when the varchar field is changed as part of the update statement, the value contained in the blob also changes. The fix would be to actually store the value by allocating space for the blob's string. We can avoid allocating this space when the varchar field is not being written into.
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/update.result13
1 files changed, 13 insertions, 0 deletions
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index 54170ae3dad..d15130d1254 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -551,3 +551,16 @@ ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function
DROP VIEW v1;
DROP FUNCTION f1;
DROP TABLE t1;
+# Bug #21143080: UPDATE ON VARCHAR AND TEXT COLUMNS PRODUCE INCORRECT
+# RESULTS
+CREATE TABLE t1 (a VARCHAR(50), b TEXT, c CHAR(50)) ENGINE=INNODB;
+INSERT INTO t1 (a, b, c) VALUES ('start trail', '', 'even longer string');
+UPDATE t1 SET b = a, a = 'inject';
+SELECT a, b FROM t1;
+a b
+inject start trail
+UPDATE t1 SET b = c, c = 'inject';
+SELECT c, b FROM t1;
+c b
+inject even longer string
+DROP TABLE t1;