Bug #20046 Qcache invalidate crashes when using a SP which uses a PS and a View
Submitted: 24 May 2006 13:31 Modified: 24 May 2006 16:24
Reporter: Matthew Lord Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.0.21, 5.0.22-bk OS:Linux (Linux 2.4, 2.6 - Windows 2003)
Assigned to: CPU Architecture:Any

[24 May 2006 13:31] Matthew Lord
Description:
Crash is occuring in Query_cache::invalidate ().  A small test case below.  If query 
cache size is set to 0 then the crash does not occur.

How to repeat:
######
DROP DATABASE IF EXISTS `test`;
CREATE DATABASE `test`;
USE `test`;

DROP PROCEDURE IF EXISTS `p1`;
DELIMITER //
CREATE PROCEDURE `p1`()
BEGIN
start transaction;
SET @sqlstr="INSERT INTO t1(`c1`) SELECT `c1` FROM v1";
PREPARE stmt FROM @sqlstr;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END//
DELIMITER ;

DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1`(`c1` int) ENGINE=MyISAM DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `t2`;
CREATE TABLE `t2`(`c1` INT) ENGINE=MyISAM DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `t3`;
CREATE TABLE `t3`(`c1` INT) ENGINE=MyISAM DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `v1`;
DROP VIEW IF EXISTS `v1`;
CREATE VIEW `v1` AS select `t3`.`c1` AS `c1` FROM `t3`,`t2` WHERE `t3`.`c1` = `t2`.`c1`;

call `p1`();
########