mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fix for #3266 (garbled TEXT fields as a result of CREATE TABLE SELECT)
Problem is that Item::save_in_field modifies str_value member before it calls val_str but Item_copy_string::val_str just returns this str_value as the result. I added local String variable to the Item::save_in_field
This commit is contained in:
@ -529,3 +529,14 @@ t5 CREATE TABLE `t5` (
|
||||
KEY `PRIMARY_2` (`PRIMARY`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1, t2, t3, t4, t5;
|
||||
CREATE TABLE t1(id varchar(10) NOT NULL PRIMARY KEY, dsc longtext);
|
||||
INSERT INTO t1 VALUES ('5000000001', NULL),('5000000003', 'Test'),('5000000004', NULL);
|
||||
CREATE TABLE t2(id varchar(15) NOT NULL, proc varchar(100) NOT NULL, runID varchar(16) NOT NULL, start datetime NOT NULL, PRIMARY KEY (id,proc,runID,start));
|
||||
INSERT INTO t2 VALUES ('5000000001', 'proc01', '20031029090650', '2003-10-29 13:38:40'),('5000000001', 'proc02', '20031029090650', '2003-10-29 13:38:51'),('5000000001', 'proc03', '20031029090650', '2003-10-29 13:38:11'),('5000000002', 'proc09', '20031024013310', '2003-10-24 01:33:11'),('5000000002', 'proc09', '20031024153537', '2003-10-24 15:36:04'),('5000000004', 'proc01', '20031024013641', '2003-10-24 01:37:29'),('5000000004', 'proc02', '20031024013641', '2003-10-24 01:37:39');
|
||||
CREATE TABLE t3 SELECT t1.dsc,COUNT(DISTINCT t2.id) AS countOfRuns FROM t1 LEFT JOIN t2 ON (t1.id=t2.id) GROUP BY t1.id;
|
||||
SELECT * FROM t3;
|
||||
dsc countOfRuns
|
||||
NULL 1
|
||||
Test 0
|
||||
NULL 1
|
||||
drop table t1, t2, t3;
|
||||
|
Reference in New Issue
Block a user