File tree Expand file tree Collapse file tree 3 files changed +86
-1
lines changed Expand file tree Collapse file tree 3 files changed +86
-1
lines changed Original file line number Diff line number Diff line change
1
+ drop table if exists t1,t2;
2
+ drop procedure if exists p1;
3
+ #
4
+ #MDEV-6985: MariaDB crashes on stored procedure call
5
+ #
6
+ CREATE TABLE `t1` (
7
+ `ID` int(11) NOT NULL,
8
+ PRIMARY KEY (`ID`)
9
+ ) ENGINE=InnoDB;
10
+ CREATE TABLE `t2` (
11
+ `ID` int(11) NOT NULL,
12
+ `DATE` datetime DEFAULT NULL,
13
+ PRIMARY KEY (`ID`)
14
+ ) ENGINE=InnoDB;
15
+ CREATE PROCEDURE `p1`()
16
+ BEGIN
17
+ DECLARE _mySelect CURSOR FOR
18
+ SELECT DISTINCT t1.ID
19
+ FROM t1
20
+ LEFT JOIN t2 AS t2 ON
21
+ t2.ID = t1.ID
22
+ AND t2.DATE = (
23
+ SELECT MAX(T3.DATE) FROM t2 AS T3 WHERE T3.ID = t2.ID AND T3.DATE<=NOW()
24
+ )
25
+ WHERE t1.ID = 1;
26
+ OPEN _mySelect;
27
+ CLOSE _mySelect;
28
+ END ;;
29
+ CALL p1();
30
+ CALL p1();
31
+ drop procedure p1;
32
+ drop table t1,t2;
Original file line number Diff line number Diff line change
1
+
2
+ --source include/have_innodb.inc
3
+
4
+ --disable_warnings
5
+ drop table if exists t1,t2;
6
+ drop procedure if exists p1;
7
+ --enable_warnings
8
+
9
+ --echo #
10
+ --echo #MDEV-6985: MariaDB crashes on stored procedure call
11
+ --echo #
12
+ CREATE TABLE `t1` (
13
+ `ID` int(11) NOT NULL,
14
+ PRIMARY KEY (`ID`)
15
+ ) ENGINE=InnoDB;
16
+
17
+ CREATE TABLE `t2` (
18
+ `ID` int(11) NOT NULL,
19
+ `DATE` datetime DEFAULT NULL,
20
+ PRIMARY KEY (`ID`)
21
+ ) ENGINE=InnoDB;
22
+
23
+ --delimiter ;;
24
+
25
+ CREATE PROCEDURE `p1`()
26
+ BEGIN
27
+ DECLARE _mySelect CURSOR FOR
28
+ SELECT DISTINCT t1.ID
29
+ FROM t1
30
+ LEFT JOIN t2 AS t2 ON
31
+ t2.ID = t1.ID
32
+ AND t2.DATE = (
33
+ SELECT MAX(T3.DATE) FROM t2 AS T3 WHERE T3.ID = t2.ID AND T3.DATE<=NOW()
34
+ )
35
+ WHERE t1.ID = 1;
36
+ OPEN _mySelect;
37
+ CLOSE _mySelect;
38
+ END ;;
39
+ --delimiter ;
40
+
41
+ CALL p1();
42
+ CALL p1();
43
+
44
+ drop procedure p1;
45
+ drop table t1,t2;
Original file line number Diff line number Diff line change @@ -862,12 +862,20 @@ void Item_ident::cleanup()
862
862
field_name ? field_name : " (null)" ,
863
863
orig_field_name ? orig_field_name : " (null)" ));
864
864
#endif
865
+ bool was_fixed= fixed;
865
866
Item::cleanup ();
866
867
db_name= orig_db_name;
867
868
table_name= orig_table_name;
868
869
field_name= orig_field_name;
869
870
/* Store if this Item was depended */
870
- can_be_depended= test (depended_from);
871
+ if (was_fixed)
872
+ {
873
+ /*
874
+ We can trust that depended_from set correctly only if this item
875
+ was fixed
876
+ */
877
+ can_be_depended= test (depended_from);
878
+ }
871
879
DBUG_VOID_RETURN;
872
880
}
873
881
You can’t perform that action at this time.
0 commit comments