mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
sql_base.cc:
Fixed bug #12470. A misplaced initialization of the cond_count counter resulted in a wrong calculation of it. This caused a memory corruption since this counter was used as a parameter of some memory allocation. view.test: Added a test case for bug #12470.
This commit is contained in:
@@ -1917,6 +1917,23 @@ SELECT * FROM v1;
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
#
|
||||
# Test for bug #12470: crash for a simple select from a view defined
|
||||
# as a join over 5 tables
|
||||
|
||||
CREATE TABLE t1 (pk int PRIMARY KEY, b int);
|
||||
CREATE TABLE t2 (pk int PRIMARY KEY, fk int, INDEX idx(fk));
|
||||
CREATE TABLE t3 (pk int PRIMARY KEY, fk int, INDEX idx(fk));
|
||||
CREATE TABLE t4 (pk int PRIMARY KEY, fk int, INDEX idx(fk));
|
||||
CREATE TABLE t5 (pk int PRIMARY KEY, fk int, INDEX idx(fk));
|
||||
CREATE VIEW v1 AS
|
||||
SELECT t1.pk as a FROM t1,t2,t3,t4,t5
|
||||
WHERE t1.b IS NULL AND
|
||||
t1.pk=t2.fk AND t2.pk=t3.fk AND t3.pk=t4.fk AND t4.pk=t5.fk;
|
||||
|
||||
SELECT a FROM v1;
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1,t2,t3,t4,t5;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user