diff options
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/derived_view.result | 53 | ||||
-rw-r--r-- | mysql-test/r/gis-precise.result | 10 | ||||
-rw-r--r-- | mysql-test/r/group_by.result | 47 | ||||
-rw-r--r-- | mysql-test/r/in_datetime_241.result | 5 | ||||
-rw-r--r-- | mysql-test/r/subselect.result | 43 | ||||
-rw-r--r-- | mysql-test/r/subselect_no_mat.result | 43 | ||||
-rw-r--r-- | mysql-test/r/subselect_no_opts.result | 43 | ||||
-rw-r--r-- | mysql-test/r/subselect_no_scache.result | 43 | ||||
-rw-r--r-- | mysql-test/r/subselect_no_semijoin.result | 43 | ||||
-rw-r--r-- | mysql-test/r/subselect_sj.result | 40 | ||||
-rw-r--r-- | mysql-test/r/subselect_sj_jcl6.result | 40 | ||||
-rw-r--r-- | mysql-test/r/type_date.result | 6 | ||||
-rw-r--r-- | mysql-test/r/update_ignore_216.result | 9 | ||||
-rw-r--r-- | mysql-test/t/derived_view.test | 24 | ||||
-rw-r--r-- | mysql-test/t/gis-precise.test | 5 | ||||
-rw-r--r-- | mysql-test/t/group_by.test | 39 | ||||
-rw-r--r-- | mysql-test/t/in_datetime_241.test | 9 | ||||
-rw-r--r-- | mysql-test/t/subselect.test | 29 | ||||
-rw-r--r-- | mysql-test/t/subselect_sj.test | 33 | ||||
-rw-r--r-- | mysql-test/t/type_date.test | 7 | ||||
-rw-r--r-- | mysql-test/t/update_ignore_216.test | 13 |
21 files changed, 572 insertions, 12 deletions
diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result index 32081c13376..176d39c50a9 100644 --- a/mysql-test/r/derived_view.result +++ b/mysql-test/r/derived_view.result @@ -2044,6 +2044,59 @@ a drop table t1,t2; set optimizer_switch=@save968720_optimizer_switch; # +# LP BUG#978847 Server crashes in Item_ref::real_item on +# INSERT .. SELECT with FROM subquery and derived_merge=ON +SET @save978847_optimizer_switch=@@optimizer_switch; +SET optimizer_switch = 'derived_merge=on'; +CREATE TABLE t1 ( a INT, b INT ); +INSERT INTO t1 VALUES (2,1),(3,2); +select * from t1; +a b +2 1 +3 2 +INSERT INTO t1 SELECT * FROM +( SELECT * FROM t1 ) AS alias; +select * from t1; +a b +2 1 +3 2 +2 1 +3 2 +prepare stmt1 from 'INSERT INTO t1 SELECT SQL_BIG_RESULT * FROM + ( SELECT * FROM t1 ) AS alias'; +execute stmt1; +select * from t1; +a b +2 1 +3 2 +2 1 +3 2 +2 1 +3 2 +2 1 +3 2 +execute stmt1; +select * from t1; +a b +2 1 +3 2 +2 1 +3 2 +2 1 +3 2 +2 1 +3 2 +2 1 +3 2 +2 1 +3 2 +2 1 +3 2 +2 1 +3 2 +drop table t1; +set optimizer_switch=@save978847_optimizer_switch; +# # end of 5.3 tests # set optimizer_switch=@exit_optimizer_switch; diff --git a/mysql-test/r/gis-precise.result b/mysql-test/r/gis-precise.result index b8d52ddaa43..3b07be3930a 100644 --- a/mysql-test/r/gis-precise.result +++ b/mysql-test/r/gis-precise.result @@ -437,18 +437,18 @@ ST_INTERSECTS( GeomFromText('MULTILINESTRING( ( 4030 3045 , 3149 2461 , 3004 383 select ASTEXT(ST_BUFFER(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'), -3)); ASTEXT(ST_BUFFER(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'), -3)) POLYGON((3.999999999999999 6.999999999999998,4 7,3.999999999999999 6.999999999999998)) -SELECT ASTEXT(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 -3.0, +SELECT ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 -3.0, -2.910427500435995 0.727606875108998, -0.910427500435995 8.727606875108998, 7.664100588675687 1.503849116986468, 1.664100588675687 -2.496150883013531, 0.0 -3.0 -))' ), 3 )); -ASTEXT(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 -3.0, +))' ), 3 ))); +ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 -3.0, -2.910427500435995 0.727606875108998, -0.910427500435995 8.727606875108998, 7.664100588675687 1.503849116986468, 1.664100588675687 -2.496150883013531, 0.0 -3.0 -))' ), 3 )) -POLYGON((-0.07293649627016707 -5.999113246863451,-0.22000815313430944 -5.991921859366389,-0.36654979108711294 -5.9775226700487085,-0.5122083784872182 -5.955950367818698,-0.6566330110393919 -5.927256922241938,-0.7994757571537123 -5.891511458342072,-0.9403924961432446 -5.848800090072569,-1.0790437472409127 -5.799225712860663,-1.2150954874384077 -5.742907755723261,-1.3482199561768686 -5.679981893551977,-1.4780964449507783 -5.610599720260437,-1.604412069922844 -5.534928383581259,-1.7268625256885657 -5.453150182392531,-1.8451528183746095 -5.365462127543841,-1.95899797630489 -5.272075467239885,-2.068123736522295 -5.173215178125043,-2.172267205512173 -5.069119423294928,-2.2711774925358363 -4.96003897854064,-2.364616314048327 -4.846236628207907,-5.275043814484322 -1.1186297530989093,-5.319230881155628 -1.060595091401963,-5.4040722837148305 -0.9402467440153693,-5.482906277573628 -0.8158803911735814,-5.555542944735771 -0.6877956423138013,-5.621807297107846 -0.5563010648149315,-5.681539698060918 -0.421713440631731,-5.734596247009149 -0.28435700313934065,-5.78084912607892 -0.14456265602668295,-5.820186908033274 -0.002667176120491166,-5.852514824709904 0.14098759793956495,-5.877754995325945 0.28605558922010244,-5.895846614099603 0.43218731622367124,-5.906746096736613 0.5790307348202924,-5.910427185428624 0.7262320863526014,-5.906881012110549 0.873436749871442,-5.896116119824521 1.0202900964487915,-5.878158442138949 1.166438343509911,-5.853051240672284 1.3115294071265557,-5.82085500087199 1.455213750217997,-3.8208550008719904 9.455213750217997,-3.810890509428993 9.493971235882178,-3.7697930578388252 9.635367090770822,-3.7218071441700307 9.774576071789534,-3.667048370691708 9.91126281230977,-3.6056486560854664 10.045098022001275,-3.537755917641774 10.175759280121321,-3.4635337149142433 10.302931812254522,-3.38316085569034 10.426309248631974,-3.296830965227768 10.54559436220285,-3.204752019794256 10.660499784680422,-3.1071458456345153 10.770748698837412,-3.00424758457139 10.876075505382953,-2.8963051275286036 10.976226462814537,-2.783578517339813 11.070960298703525,-2.666339322282651 11.160048790941556,-2.544869981846949 11.243277317547594,-2.419463126313273 11.320445373711095,-2.2904208717809498 11.391367054825631,-2.158054092343913 11.455871504349394,-2.0226816711677866 11.513803325413559,-1.8846297322724088 11.565022955186954,-1.7442308548704988 11.609407001095144,-1.6018232721552075 11.646848538083955,-1.4577500564667278 11.67725736621129,-1.312358292800976 11.700560227946688,-1.1659982426514375 11.71670098465514,-1.0190225001985485 11.725640751839975,-0.8717851428794332 11.72735799281901,-0.7246408783843428 11.721848570608318,-0.5779441901347602 11.709125757888568,-0.4320484833017919 11.689220205029992,-0.28730523342215375 11.662179866252945,-0.1440631396628158 11.628069884101997,-0.002667284774170997 11.586972432511828,0.13654169624454027 11.538986518843034,0.2732284367647777 11.484227745364711,0.40706364645628224 11.42282803075847,0.5377249045763282 11.354935292314778,0.6648974367095297 11.280713089587247,0.7882748730869795 11.200340230363343,0.9075599866578576 11.114010339900771,1.022465409135429 11.02193139446726,9.59699349824711 3.798173636344729,9.681101497474424 3.7245938870816415,9.787638712688917 3.622949359037885,9.889060138562687 3.516199732899768,9.985121441997343 3.4046021778668174,10.075591202898927 3.2884255422239015,10.160251471689218 3.167949705662155,10.238898294365335 3.043464905024292,10.3113422038428 2.9152710350986295,10.37740867639835 2.783676926146276,10.436938552112853 2.6489995999019795,10.489788418301517 2.5115635058410044,10.535830955007588 2.371699739551923,10.574955241727293 2.2297452450983433,10.607067024627042 2.0860420032911513,10.632088943609169 1.940936207826777,10.649960718679184 1.7947774312762605,10.660639295165561 1.6479177829343097,10.664098947442213 1.5007110605571654,10.660331340903774 1.3535118980328205,10.649345552044398 1.2066749110369206,10.63116804659169 1.0605538427325394,10.605842615748447 0.9155007115719156,10.573430270695816 0.7718649632531696,10.534009095612015 0.6299926288750068,10.487674059560707 0.49022549131749327,10.43453678770221 0.3529002618571597,10.37472529237871 0.2183477690000466,10.308383664721301 0.08689216148685275,10.235671727521858 -0.0411498726097721,10.156764650205906 -0.16546986881453063,10.07185252683414 -0.2857683293674196,9.98113991814919 -0.40175544474006797,9.88484535877086 -0.5131517918122694,9.783200830727104 -0.6196890070267613,9.676451204588986 -0.7211104329005329,9.564853649556037 -0.8171717363351869,9.448677013913121 -0.9076414972367728,9.328201177351374 -0.9923017660270632,3.328201177351374 -4.992301766027062,3.205062809741012 -5.070143002902289,3.076906846199522 -5.1426539490804295,2.9453473086364443 -5.208789237566124,2.8107011355010223 -5.268389542656644,2.673292701217952 -5.321311281996655,2.533453034740978 -5.367426962480689,0.8693524460652908 -5.871276079467158,0.8008007456874348 -5.891144784632282,0.6579743953925739 -5.92695570431255,0.5135629271474615 -5.9557153313300875,0.3679142408280516 -5.977354381224364,0.22137921687700501 -5.991820723628828,0.07431087100197242 -5.999079507857523,-0.07293649627016707 -5.999113246863451)) +))' ), +136 diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index cffed9529d6..74e9cd3caaa 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -1976,6 +1976,53 @@ Warning 1292 Truncated incorrect DOUBLE value: 'g' Warning 1292 Truncated incorrect DOUBLE value: 'v' SET SESSION SQL_MODE=default; drop table t1; +# +# LP bug#967242 Wrong result (extra rows, not grouped) with JOIN, AND in ON condition, multi-part key, GROUP BY, OR in WHERE +# +CREATE TABLE t1 ( a VARCHAR(1) ) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('x'); +CREATE TABLE t2 ( b INT, c VARCHAR(1), KEY (c, b) ) ENGINE=MyISAM; +INSERT INTO t2 VALUES +(4, 'd'),(8, 'g'),(3, 'x'),(3, 'f'), +(0, 'p'),(3, 'j'),(8, 'c'); +SELECT t2_1.b as zzz +FROM t1 JOIN t2 AS t2_1 JOIN t2 AS t2_2 +ON (t2_2.b = t2_1.b ) AND (t2_2.c = t2_1.c ) +WHERE +rand() + 1 > 0 OR +a = t2_1.c +GROUP BY zzz; +zzz +0 +3 +4 +8 +SELECT t2_1.b as zzz +FROM t1 JOIN t2 AS t2_1 JOIN t2 AS t2_2 +ON (t2_2.b = t2_1.b ) AND (t2_2.c = t2_1.c ) +WHERE +1 > 0 OR +a = t2_1.c +GROUP BY zzz; +zzz +0 +3 +4 +8 +SELECT t2_1.b as zzz +FROM t1 JOIN t2 AS t2_1 JOIN t2 AS t2_2 +ON (t2_2.b = t2_1.b ) AND (t2_2.c = t2_1.c ) +WHERE +t2_1.b + 1 > 0 OR +a = t2_1.c +GROUP BY zzz; +zzz +0 +3 +4 +8 +#TODO: in merge with 5.3 add original test suite +drop table t1, t2; # End of 5.2 tests # # lp:872702: Crash in add_ref_to_table_cond() when grouping by a PK diff --git a/mysql-test/r/in_datetime_241.result b/mysql-test/r/in_datetime_241.result new file mode 100644 index 00000000000..2c5b4bd8db1 --- /dev/null +++ b/mysql-test/r/in_datetime_241.result @@ -0,0 +1,5 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( a DATE ); +SELECT * FROM t1 WHERE ( SELECT a FROM t1 ) IN ('2012-04-25','2012-04-26'); +a +DROP TABLE t1; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 29b8c41e515..dca872f0bbd 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -4585,7 +4585,7 @@ SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; MAX(b) (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) -NULL 0 +NULL NULL DROP TABLE t1, st1, st2; # # Bug #48709: Assertion failed in sql_select.cc:11782: @@ -6521,5 +6521,46 @@ INSERT INTO t1 VALUES (1); SELECT a FROM t1 WHERE ( SELECT MIN(a) = 100 ); a drop table t1; +# +# LP BUG#985667 Wrong result with subquery in SELECT clause, and constant table in +# main query and implicit grouping +# +CREATE TABLE t1 (f1 int) engine=MyISAM; +INSERT INTO t1 VALUES (7),(8); +CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM; +INSERT INTO t2 VALUES (3,'f'); +EXPLAIN +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 NULL +EXPLAIN +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 0 +EXPLAIN +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 1 +EXPLAIN +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 0 +drop table t1,t2; # return optimizer switch changed in the beginning of this test set optimizer_switch=@subselect_tmp; diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result index e8086b53ead..d5c7084c48d 100644 --- a/mysql-test/r/subselect_no_mat.result +++ b/mysql-test/r/subselect_no_mat.result @@ -4587,7 +4587,7 @@ SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; MAX(b) (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) -NULL 0 +NULL NULL DROP TABLE t1, st1, st2; # # Bug #48709: Assertion failed in sql_select.cc:11782: @@ -6520,6 +6520,47 @@ INSERT INTO t1 VALUES (1); SELECT a FROM t1 WHERE ( SELECT MIN(a) = 100 ); a drop table t1; +# +# LP BUG#985667 Wrong result with subquery in SELECT clause, and constant table in +# main query and implicit grouping +# +CREATE TABLE t1 (f1 int) engine=MyISAM; +INSERT INTO t1 VALUES (7),(8); +CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM; +INSERT INTO t2 VALUES (3,'f'); +EXPLAIN +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 NULL +EXPLAIN +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 0 +EXPLAIN +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 1 +EXPLAIN +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 0 +drop table t1,t2; # return optimizer switch changed in the beginning of this test set optimizer_switch=@subselect_tmp; set optimizer_switch=default; diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result index 12b1e45c92c..7b44b1a1f5d 100644 --- a/mysql-test/r/subselect_no_opts.result +++ b/mysql-test/r/subselect_no_opts.result @@ -4583,7 +4583,7 @@ SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; MAX(b) (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) -NULL 0 +NULL NULL DROP TABLE t1, st1, st2; # # Bug #48709: Assertion failed in sql_select.cc:11782: @@ -6516,6 +6516,47 @@ INSERT INTO t1 VALUES (1); SELECT a FROM t1 WHERE ( SELECT MIN(a) = 100 ); a drop table t1; +# +# LP BUG#985667 Wrong result with subquery in SELECT clause, and constant table in +# main query and implicit grouping +# +CREATE TABLE t1 (f1 int) engine=MyISAM; +INSERT INTO t1 VALUES (7),(8); +CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM; +INSERT INTO t2 VALUES (3,'f'); +EXPLAIN +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 NULL +EXPLAIN +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 0 +EXPLAIN +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 1 +EXPLAIN +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 0 +drop table t1,t2; # return optimizer switch changed in the beginning of this test set optimizer_switch=@subselect_tmp; set @optimizer_switch_for_subselect_test=null; diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result index b9a4f9b23a9..9b24af0dc3a 100644 --- a/mysql-test/r/subselect_no_scache.result +++ b/mysql-test/r/subselect_no_scache.result @@ -4591,7 +4591,7 @@ SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; MAX(b) (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) -NULL 0 +NULL NULL DROP TABLE t1, st1, st2; # # Bug #48709: Assertion failed in sql_select.cc:11782: @@ -6527,6 +6527,47 @@ INSERT INTO t1 VALUES (1); SELECT a FROM t1 WHERE ( SELECT MIN(a) = 100 ); a drop table t1; +# +# LP BUG#985667 Wrong result with subquery in SELECT clause, and constant table in +# main query and implicit grouping +# +CREATE TABLE t1 (f1 int) engine=MyISAM; +INSERT INTO t1 VALUES (7),(8); +CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM; +INSERT INTO t2 VALUES (3,'f'); +EXPLAIN +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 NULL +EXPLAIN +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 0 +EXPLAIN +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 1 +EXPLAIN +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 0 +drop table t1,t2; # return optimizer switch changed in the beginning of this test set optimizer_switch=@subselect_tmp; set optimizer_switch=default; diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result index ad6d61e9ec9..ba42ff881fc 100644 --- a/mysql-test/r/subselect_no_semijoin.result +++ b/mysql-test/r/subselect_no_semijoin.result @@ -4583,7 +4583,7 @@ SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; MAX(b) (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) -NULL 0 +NULL NULL DROP TABLE t1, st1, st2; # # Bug #48709: Assertion failed in sql_select.cc:11782: @@ -6516,6 +6516,47 @@ INSERT INTO t1 VALUES (1); SELECT a FROM t1 WHERE ( SELECT MIN(a) = 100 ); a drop table t1; +# +# LP BUG#985667 Wrong result with subquery in SELECT clause, and constant table in +# main query and implicit grouping +# +CREATE TABLE t1 (f1 int) engine=MyISAM; +INSERT INTO t1 VALUES (7),(8); +CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM; +INSERT INTO t2 VALUES (3,'f'); +EXPLAIN +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 NULL +EXPLAIN +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 0 +EXPLAIN +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 1 +EXPLAIN +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 0 +drop table t1,t2; # return optimizer switch changed in the beginning of this test set optimizer_switch=@subselect_tmp; set @optimizer_switch_for_subselect_test=null; diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result index ca834b21df5..f8ebe0d07a9 100644 --- a/mysql-test/r/subselect_sj.result +++ b/mysql-test/r/subselect_sj.result @@ -2671,4 +2671,44 @@ a DEALLOCATE PREPARE pstmt; DROP VIEW v1; DROP TABLE t1, t2; +# +# BUG#978479: Wrong result (extra rows) with derived_with_keys+loosescan+semijoin=ON, materialization=OFF +# +set @tmp_jcl_978479= @@join_cache_level; +set join_cache_level=0; +set @tmp_os_978479= @@optimizer_switch; +set optimizer_switch = 'derived_with_keys=on,loosescan=on,semijoin=on,materialization=off'; +# Part#1: make sure EXPLAIN is using LooseScan: +CREATE TABLE t1 ( a INT, b INT ); +INSERT INTO t1 VALUES +(4,0),(6,8),(3,1),(5,8),(3,9),(2,4), +(2,6),(9,1),(5,4),(7,7),(5,4); +CREATE ALGORITHM=TEMPTABLE +VIEW v1 AS SELECT * FROM t1; +# This will use LooseScan: +EXPLAIN +SELECT * FROM t1 AS t1_1, t1 AS t1_2 +WHERE (t1_1.a, t1_2.a) IN ( SELECT a, b FROM v1 ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1_1 ALL NULL NULL NULL NULL 11 Using where +1 PRIMARY <derived3> ref key0 key0 5 test.t1_1.a 2 Start temporary +1 PRIMARY t1_2 ALL NULL NULL NULL NULL 11 Using where; End temporary +3 DERIVED t1 ALL NULL NULL NULL NULL 11 +SELECT * FROM t1 AS t1_1, t1 AS t1_2 +WHERE (t1_1.a, t1_2.a) IN ( SELECT a, b FROM v1 ); +a b a b +3 1 9 1 +5 8 4 0 +3 9 9 1 +2 4 6 8 +2 4 4 0 +2 6 6 8 +2 6 4 0 +5 4 4 0 +7 7 7 7 +5 4 4 0 +DROP VIEW v1; +DROP TABLE t1; +set @@join_cache_level= @tmp_jcl_978479; +set @@optimizer_switch= @tmp_os_978479; set optimizer_switch=@subselect_sj_tmp; diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result index 19f3baac5f2..c0a9287483d 100644 --- a/mysql-test/r/subselect_sj_jcl6.result +++ b/mysql-test/r/subselect_sj_jcl6.result @@ -2685,6 +2685,46 @@ a DEALLOCATE PREPARE pstmt; DROP VIEW v1; DROP TABLE t1, t2; +# +# BUG#978479: Wrong result (extra rows) with derived_with_keys+loosescan+semijoin=ON, materialization=OFF +# +set @tmp_jcl_978479= @@join_cache_level; +set join_cache_level=0; +set @tmp_os_978479= @@optimizer_switch; +set optimizer_switch = 'derived_with_keys=on,loosescan=on,semijoin=on,materialization=off'; +# Part#1: make sure EXPLAIN is using LooseScan: +CREATE TABLE t1 ( a INT, b INT ); +INSERT INTO t1 VALUES +(4,0),(6,8),(3,1),(5,8),(3,9),(2,4), +(2,6),(9,1),(5,4),(7,7),(5,4); +CREATE ALGORITHM=TEMPTABLE +VIEW v1 AS SELECT * FROM t1; +# This will use LooseScan: +EXPLAIN +SELECT * FROM t1 AS t1_1, t1 AS t1_2 +WHERE (t1_1.a, t1_2.a) IN ( SELECT a, b FROM v1 ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1_1 ALL NULL NULL NULL NULL 11 Using where +1 PRIMARY <derived3> ref key0 key0 5 test.t1_1.a 2 Start temporary +1 PRIMARY t1_2 ALL NULL NULL NULL NULL 11 Using where; End temporary +3 DERIVED t1 ALL NULL NULL NULL NULL 11 +SELECT * FROM t1 AS t1_1, t1 AS t1_2 +WHERE (t1_1.a, t1_2.a) IN ( SELECT a, b FROM v1 ); +a b a b +3 1 9 1 +5 8 4 0 +3 9 9 1 +2 4 6 8 +2 4 4 0 +2 6 6 8 +2 6 4 0 +5 4 4 0 +7 7 7 7 +5 4 4 0 +DROP VIEW v1; +DROP TABLE t1; +set @@join_cache_level= @tmp_jcl_978479; +set @@optimizer_switch= @tmp_os_978479; set optimizer_switch=@subselect_sj_tmp; # # BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index 8d069477f3e..fbac1752c37 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -21,6 +21,12 @@ name cdate note name1 1998-01-01 note01 name2 1998-01-01 note01 drop table t1,t2; +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(1); +SELECT * FROM t1 WHERE LAST_DAY('0000-00-00 00:00:00') IS NULL; +a +1 +DROP TABLE t1; CREATE TABLE t1 ( datum DATE ); INSERT INTO t1 VALUES ( "2000-1-1" ); INSERT INTO t1 VALUES ( "2000-1-2" ); diff --git a/mysql-test/r/update_ignore_216.result b/mysql-test/r/update_ignore_216.result new file mode 100644 index 00000000000..4abc1eae06e --- /dev/null +++ b/mysql-test/r/update_ignore_216.result @@ -0,0 +1,9 @@ +CREATE TABLE t1 ( a INT, b CHAR(3) ); +INSERT INTO t1 VALUES ( 1, 'foo' ); +CREATE TABLE t2 ( c CHAR(3), d INT ); +INSERT INTO t2 VALUES ( 'foo', 1 ); +UPDATE IGNORE t1, t2 SET b = 'bar', c = 'bar' + WHERE a != ( SELECT 1 UNION SELECT 2 ); +Warnings: +Warning 1242 Subquery returns more than 1 row +DROP TABLE t1, t2; diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test index 03d308b6c45..3320ca25136 100644 --- a/mysql-test/t/derived_view.test +++ b/mysql-test/t/derived_view.test @@ -1414,6 +1414,30 @@ drop table t1,t2; set optimizer_switch=@save968720_optimizer_switch; --echo # +--echo # LP BUG#978847 Server crashes in Item_ref::real_item on +--echo # INSERT .. SELECT with FROM subquery and derived_merge=ON +SET @save978847_optimizer_switch=@@optimizer_switch; +SET optimizer_switch = 'derived_merge=on'; + +CREATE TABLE t1 ( a INT, b INT ); +INSERT INTO t1 VALUES (2,1),(3,2); + +select * from t1; +INSERT INTO t1 SELECT * FROM + ( SELECT * FROM t1 ) AS alias; +select * from t1; +prepare stmt1 from 'INSERT INTO t1 SELECT SQL_BIG_RESULT * FROM + ( SELECT * FROM t1 ) AS alias'; +execute stmt1; +select * from t1; +execute stmt1; +select * from t1; + +drop table t1; + +set optimizer_switch=@save978847_optimizer_switch; + +--echo # --echo # end of 5.3 tests --echo # diff --git a/mysql-test/t/gis-precise.test b/mysql-test/t/gis-precise.test index 8a10f6dd467..d021bb0b53d 100644 --- a/mysql-test/t/gis-precise.test +++ b/mysql-test/t/gis-precise.test @@ -317,10 +317,11 @@ SELECT ST_INTERSECTS( GeomFromText('MULTILINESTRING( ( 4030 3045 , 3149 2461 , 3 select ASTEXT(ST_BUFFER(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'), -3)); #bug 986977 Assertion `!cur_p->event' failed in Gcalc_scan_iterator::arrange_event(int, int) -SELECT ASTEXT(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 -3.0, +SELECT ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 -3.0, -2.910427500435995 0.727606875108998, -0.910427500435995 8.727606875108998, 7.664100588675687 1.503849116986468, 1.664100588675687 -2.496150883013531, 0.0 -3.0 -))' ), 3 )); +))' ), 3 ))); + diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index db8bfce2320..a6054e0a28a 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1339,6 +1339,45 @@ SELECT alias2.f3 AS field1 , alias2.f1 AS field2 FROM t1 AS alias1 JOIN t1 AS al SET SESSION SQL_MODE=default; drop table t1; +--echo # +--echo # LP bug#967242 Wrong result (extra rows, not grouped) with JOIN, AND in ON condition, multi-part key, GROUP BY, OR in WHERE +--echo # + +CREATE TABLE t1 ( a VARCHAR(1) ) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('x'); +CREATE TABLE t2 ( b INT, c VARCHAR(1), KEY (c, b) ) ENGINE=MyISAM; +INSERT INTO t2 VALUES +(4, 'd'),(8, 'g'),(3, 'x'),(3, 'f'), +(0, 'p'),(3, 'j'),(8, 'c'); + +SELECT t2_1.b as zzz +FROM t1 JOIN t2 AS t2_1 JOIN t2 AS t2_2 +ON (t2_2.b = t2_1.b ) AND (t2_2.c = t2_1.c ) +WHERE +rand() + 1 > 0 OR +a = t2_1.c +GROUP BY zzz; + +SELECT t2_1.b as zzz +FROM t1 JOIN t2 AS t2_1 JOIN t2 AS t2_2 +ON (t2_2.b = t2_1.b ) AND (t2_2.c = t2_1.c ) +WHERE +1 > 0 OR +a = t2_1.c +GROUP BY zzz; + +SELECT t2_1.b as zzz +FROM t1 JOIN t2 AS t2_1 JOIN t2 AS t2_2 +ON (t2_2.b = t2_1.b ) AND (t2_2.c = t2_1.c ) +WHERE +t2_1.b + 1 > 0 OR +a = t2_1.c +GROUP BY zzz; + +--echo #TODO: in merge with 5.3 add original test suite + +drop table t1, t2; + --echo # End of 5.2 tests --echo # diff --git a/mysql-test/t/in_datetime_241.test b/mysql-test/t/in_datetime_241.test new file mode 100644 index 00000000000..f95a456f5e2 --- /dev/null +++ b/mysql-test/t/in_datetime_241.test @@ -0,0 +1,9 @@ +# +# MDEV-241 lp:992722 - Server crashes in get_datetime_value +# +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +CREATE TABLE t1 ( a DATE ); +SELECT * FROM t1 WHERE ( SELECT a FROM t1 ) IN ('2012-04-25','2012-04-26'); +DROP TABLE t1; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index f369f10a5e4..6e98c064d94 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -5499,6 +5499,35 @@ SELECT a FROM t1 WHERE ( SELECT MIN(a) = 100 ); drop table t1; +--echo # +--echo # LP BUG#985667 Wrong result with subquery in SELECT clause, and constant table in +--echo # main query and implicit grouping +--echo # + +CREATE TABLE t1 (f1 int) engine=MyISAM; +INSERT INTO t1 VALUES (7),(8); + +CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM; +INSERT INTO t2 VALUES (3,'f'); + +EXPLAIN +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; + +EXPLAIN +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; + +EXPLAIN +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; + +EXPLAIN +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; + +drop table t1,t2; + --echo # return optimizer switch changed in the beginning of this test set optimizer_switch=@subselect_tmp; diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test index 2fb6f6b53b8..7f1181bb562 100644 --- a/mysql-test/t/subselect_sj.test +++ b/mysql-test/t/subselect_sj.test @@ -2366,5 +2366,38 @@ DEALLOCATE PREPARE pstmt; DROP VIEW v1; DROP TABLE t1, t2; +--echo # +--echo # BUG#978479: Wrong result (extra rows) with derived_with_keys+loosescan+semijoin=ON, materialization=OFF +--echo # + +set @tmp_jcl_978479= @@join_cache_level; +set join_cache_level=0; + +set @tmp_os_978479= @@optimizer_switch; +set optimizer_switch = 'derived_with_keys=on,loosescan=on,semijoin=on,materialization=off'; + +--echo # Part#1: make sure EXPLAIN is using LooseScan: +CREATE TABLE t1 ( a INT, b INT ); +INSERT INTO t1 VALUES + (4,0),(6,8),(3,1),(5,8),(3,9),(2,4), + (2,6),(9,1),(5,4),(7,7),(5,4); + +CREATE ALGORITHM=TEMPTABLE + VIEW v1 AS SELECT * FROM t1; + +--echo # This will use LooseScan: +EXPLAIN +SELECT * FROM t1 AS t1_1, t1 AS t1_2 + WHERE (t1_1.a, t1_2.a) IN ( SELECT a, b FROM v1 ); + +SELECT * FROM t1 AS t1_1, t1 AS t1_2 + WHERE (t1_1.a, t1_2.a) IN ( SELECT a, b FROM v1 ); + +DROP VIEW v1; +DROP TABLE t1; +set @@join_cache_level= @tmp_jcl_978479; +set @@optimizer_switch= @tmp_os_978479; + + # The following command must be the last one the file set optimizer_switch=@subselect_sj_tmp; diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test index 22b1eb97dad..52895951787 100644 --- a/mysql-test/t/type_date.test +++ b/mysql-test/t/type_date.test @@ -26,6 +26,13 @@ INSERT INTO t2 VALUES ('1998-01-02','note02'); select name,t1.cdate,note from t1,t2 where t1.cdate=t2.cdate and t1.cdate='1998-01-01'; drop table t1,t2; +# MariaDB lp:993103. WHERE LAST_DAY(zero_date) IS NULL does not evaluate to TRUE. + +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(1); +SELECT * FROM t1 WHERE LAST_DAY('0000-00-00 00:00:00') IS NULL; +DROP TABLE t1; + # # Date and BETWEEN # diff --git a/mysql-test/t/update_ignore_216.test b/mysql-test/t/update_ignore_216.test new file mode 100644 index 00000000000..bae3930e1a7 --- /dev/null +++ b/mysql-test/t/update_ignore_216.test @@ -0,0 +1,13 @@ +# +# MDEV-216 lp:976104 - Assertion `0' failed in my_message_sql on UPDATE IGNORE, or unknown error on release build +# + +CREATE TABLE t1 ( a INT, b CHAR(3) ); +INSERT INTO t1 VALUES ( 1, 'foo' ); +CREATE TABLE t2 ( c CHAR(3), d INT ); +INSERT INTO t2 VALUES ( 'foo', 1 ); + +UPDATE IGNORE t1, t2 SET b = 'bar', c = 'bar' + WHERE a != ( SELECT 1 UNION SELECT 2 ); + +DROP TABLE t1, t2; |