Skip to content

Commit 6c16fb6

Browse files
author
Ramil Kalimullin
committed
Auto-merge.
2 parents 6d96d33 + ee403cc commit 6c16fb6

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

mysql-test/r/ps.result

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,4 +1916,26 @@ execute stmt;
19161916
deallocate prepare stmt;
19171917
drop table t1,t2;
19181918
#
1919+
#
1920+
# Bug #49570: Assertion failed: !(order->used & map)
1921+
# on re-execution of prepared statement
1922+
#
1923+
CREATE TABLE t1(a INT PRIMARY KEY);
1924+
INSERT INTO t1 VALUES(0), (1);
1925+
PREPARE stmt FROM
1926+
"SELECT 1 FROM t1 JOIN t1 t2 USING(a) GROUP BY t2.a, t1.a";
1927+
EXECUTE stmt;
1928+
1
1929+
1
1930+
1
1931+
EXECUTE stmt;
1932+
1
1933+
1
1934+
1
1935+
EXECUTE stmt;
1936+
1
1937+
1
1938+
1
1939+
DEALLOCATE PREPARE stmt;
1940+
DROP TABLE t1;
19191941
End of 5.0 tests.

mysql-test/t/ps.test

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1996,4 +1996,20 @@ deallocate prepare stmt;
19961996
drop table t1,t2;
19971997
--echo #
19981998

1999+
2000+
--echo #
2001+
--echo # Bug #49570: Assertion failed: !(order->used & map)
2002+
--echo # on re-execution of prepared statement
2003+
--echo #
2004+
CREATE TABLE t1(a INT PRIMARY KEY);
2005+
INSERT INTO t1 VALUES(0), (1);
2006+
PREPARE stmt FROM
2007+
"SELECT 1 FROM t1 JOIN t1 t2 USING(a) GROUP BY t2.a, t1.a";
2008+
EXECUTE stmt;
2009+
EXECUTE stmt;
2010+
EXECUTE stmt;
2011+
DEALLOCATE PREPARE stmt;
2012+
DROP TABLE t1;
2013+
2014+
19992015
--echo End of 5.0 tests.

sql/sql_select.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6777,6 +6777,7 @@ static void update_depend_map(JOIN *join, ORDER *order)
67776777
table_map depend_map;
67786778
order->item[0]->update_used_tables();
67796779
order->depend_map=depend_map=order->item[0]->used_tables();
6780+
order->used= 0;
67806781
// Not item_sum(), RAND() and no reference to table outside of sub select
67816782
if (!(order->depend_map & (OUTER_REF_TABLE_BIT | RAND_TABLE_BIT))
67826783
&& !order->item[0]->with_sum_func)

0 commit comments

Comments
 (0)