Bug#48052: Valgrind warning - uninitialized value in
init_read_record() - (records.cc:274) Item_cond::used_tables_cache was accessed in records.cc#init_read_record() without being initialized. It had not been initialized because it was wrongly assumed that the Item's variables would not be accessed, and hence quick_fix_field() was used instead of fix_fields() to save a few CPU cycles at creation time. The fix is to properly initilize the Item by replacing quick_fix_field() with fix_fields(). mysql-test/r/select.result: Add test for BUG#48052 mysql-test/t/select.test: Add test for BUG#48052 sql/sql_select.cc: Properly initialize Item_cond_and by calling fix_fields (instead of quick_fix_field) when the Item that "ANDs" WHERE clause conditions with HAVING clause conditions is created.
This commit is contained in:
parent
cf872354a8
commit
a120e969a8
@ -4591,4 +4591,22 @@ field2
|
||||
15:13:38
|
||||
drop table A,AA,B,BB;
|
||||
#end of test for bug#45266
|
||||
#
|
||||
# BUG#48052: Valgrind warning - uninitialized value in init_read_record()
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
pk int(11) NOT NULL,
|
||||
i int(11) DEFAULT NULL,
|
||||
v varchar(1) DEFAULT NULL,
|
||||
PRIMARY KEY (pk)
|
||||
);
|
||||
INSERT INTO t1 VALUES (2,7,'m');
|
||||
INSERT INTO t1 VALUES (3,9,'m');
|
||||
SELECT v
|
||||
FROM t1
|
||||
WHERE NOT pk > 0
|
||||
HAVING v <= 't'
|
||||
ORDER BY pk;
|
||||
v
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@ -3931,4 +3931,37 @@ SELECT table1 .`time_key` field2 FROM B table1 LEFT JOIN BB JOIN A table5 ON
|
||||
|
||||
drop table A,AA,B,BB;
|
||||
--echo #end of test for bug#45266
|
||||
|
||||
--echo #
|
||||
--echo # BUG#48052: Valgrind warning - uninitialized value in init_read_record()
|
||||
--echo #
|
||||
|
||||
# Needed in 6.0 codebase
|
||||
#--echo # Disable Index condition pushdown
|
||||
#--replace_column 1 #
|
||||
#SELECT @old_icp:=@@engine_condition_pushdown;
|
||||
#SET SESSION engine_condition_pushdown = 'OFF';
|
||||
|
||||
CREATE TABLE t1 (
|
||||
pk int(11) NOT NULL,
|
||||
i int(11) DEFAULT NULL,
|
||||
v varchar(1) DEFAULT NULL,
|
||||
PRIMARY KEY (pk)
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES (2,7,'m');
|
||||
INSERT INTO t1 VALUES (3,9,'m');
|
||||
|
||||
SELECT v
|
||||
FROM t1
|
||||
WHERE NOT pk > 0
|
||||
HAVING v <= 't'
|
||||
ORDER BY pk;
|
||||
|
||||
# Needed in 6.0 codebase
|
||||
#--echo # Restore old value for Index condition pushdown
|
||||
#SET SESSION engine_condition_pushdown=@old_icp;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
@ -2131,17 +2131,13 @@ JOIN::exec()
|
||||
DBUG_VOID_RETURN;
|
||||
if (!curr_table->select->cond)
|
||||
curr_table->select->cond= sort_table_cond;
|
||||
else // This should never happen
|
||||
else
|
||||
{
|
||||
if (!(curr_table->select->cond=
|
||||
new Item_cond_and(curr_table->select->cond,
|
||||
sort_table_cond)))
|
||||
DBUG_VOID_RETURN;
|
||||
/*
|
||||
Item_cond_and do not need fix_fields for execution, its parameters
|
||||
are fixed or do not need fix_fields, too
|
||||
*/
|
||||
curr_table->select->cond->quick_fix_field();
|
||||
curr_table->select->cond->fix_fields(thd, 0);
|
||||
}
|
||||
curr_table->select_cond= curr_table->select->cond;
|
||||
curr_table->select_cond->top_level_item();
|
||||
|
Loading…
x
Reference in New Issue
Block a user