You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This patch corrects the fix of the patch for mdev-19421 that resolved
the problem of parsing some embedded join expressions such as
t1 join t2 left join t3 on t2.a=t3.a on t1.a=t2.a.
Yet the patch contained a bug that prevented proper context analysis
of the queries where such expressions were used together with comma
separated table references in from clauses.
Copy file name to clipboardExpand all lines: mysql-test/r/join.result
+326Lines changed: 326 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2921,5 +2921,331 @@ NULL NULL NULL 9
2921
2921
NULL NULL NULL 5
2922
2922
drop table t1,t2,t3,t4,s1,s2;
2923
2923
#
2924
+
# MDEV-20265: Mix of comma joins with JOIN expressions
2925
+
# (correction of the fix for MDEV-19421)
2926
+
# MDEV-20330: duplicate
2927
+
#
2928
+
create table t1 (a int);
2929
+
insert into t1 values (7), (5), (3);
2930
+
create table t2 (a int);
2931
+
insert into t2 values (5), (1), (7);
2932
+
create table t3 (a int);
2933
+
insert into t3 values (2), (7), (3);
2934
+
create table t4 (a int);
2935
+
insert into t4 values (4), (7), (9), (5);
2936
+
create table t5 (a int);
2937
+
insert into t5 values (3), (7), (9), (2);
2938
+
explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
2939
+
from t1, t2 join t3 left join t4 on t3.a=t4.a;
2940
+
id select_type table type possible_keys key key_len ref rows filtered Extra
2941
+
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
2942
+
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
2943
+
1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
2944
+
1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join)
2945
+
Warnings:
2946
+
Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` left join `test`.`t4` on((`test`.`t4`.`a` = `test`.`t3`.`a`)) where 1
2947
+
select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
2948
+
from t1, t2 join t3 left join t4 on t3.a=t4.a;
2949
+
t1_a t2_a t3_a t4_a
2950
+
7 5 7 7
2951
+
5 5 7 7
2952
+
3 5 7 7
2953
+
7 1 7 7
2954
+
5 1 7 7
2955
+
3 1 7 7
2956
+
7 7 7 7
2957
+
5 7 7 7
2958
+
3 7 7 7
2959
+
7 5 2 NULL
2960
+
5 5 2 NULL
2961
+
3 5 2 NULL
2962
+
7 1 2 NULL
2963
+
5 1 2 NULL
2964
+
3 1 2 NULL
2965
+
7 7 2 NULL
2966
+
5 7 2 NULL
2967
+
3 7 2 NULL
2968
+
7 5 3 NULL
2969
+
5 5 3 NULL
2970
+
3 5 3 NULL
2971
+
7 1 3 NULL
2972
+
5 1 3 NULL
2973
+
3 1 3 NULL
2974
+
7 7 3 NULL
2975
+
5 7 3 NULL
2976
+
3 7 3 NULL
2977
+
explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
2978
+
from t1, t2 join t3 right join t4 on t3.a=t4.a;
2979
+
id select_type table type possible_keys key key_len ref rows filtered Extra
2980
+
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
2981
+
1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join)
2982
+
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
2983
+
1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
2984
+
Warnings:
2985
+
Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t4` left join (`test`.`t2` join `test`.`t3`) on((`test`.`t3`.`a` = `test`.`t4`.`a`)) where 1
2986
+
select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
2987
+
from t1, t2 join t3 right join t4 on t3.a=t4.a;
2988
+
t1_a t2_a t3_a t4_a
2989
+
7 5 7 7
2990
+
5 5 7 7
2991
+
3 5 7 7
2992
+
7 1 7 7
2993
+
5 1 7 7
2994
+
3 1 7 7
2995
+
7 7 7 7
2996
+
5 7 7 7
2997
+
3 7 7 7
2998
+
7 NULL NULL 4
2999
+
5 NULL NULL 4
3000
+
3 NULL NULL 4
3001
+
7 NULL NULL 9
3002
+
5 NULL NULL 9
3003
+
3 NULL NULL 9
3004
+
7 NULL NULL 5
3005
+
5 NULL NULL 5
3006
+
3 NULL NULL 5
3007
+
explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a, t5.a as t5_a
3008
+
from t1, t2 join t3 join t4 left join t5 on t4.a=t5.a;
3009
+
id select_type table type possible_keys key key_len ref rows filtered Extra
3010
+
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
3011
+
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
3012
+
1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
3013
+
1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join)
3014
+
1 SIMPLE t5 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join)
3015
+
Warnings:
3016
+
Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a`,`test`.`t5`.`a` AS `t5_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` join `test`.`t4` left join `test`.`t5` on((`test`.`t5`.`a` = `test`.`t4`.`a`)) where 1
3017
+
select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a, t5.a as t5_a
3018
+
from t1, t2 join t3 join t4 left join t5 on t4.a=t5.a;
3019
+
t1_a t2_a t3_a t4_a t5_a
3020
+
7 5 2 7 7
3021
+
5 5 2 7 7
3022
+
3 5 2 7 7
3023
+
7 1 2 7 7
3024
+
5 1 2 7 7
3025
+
3 1 2 7 7
3026
+
7 7 2 7 7
3027
+
5 7 2 7 7
3028
+
3 7 2 7 7
3029
+
7 5 7 7 7
3030
+
5 5 7 7 7
3031
+
3 5 7 7 7
3032
+
7 1 7 7 7
3033
+
5 1 7 7 7
3034
+
3 1 7 7 7
3035
+
7 7 7 7 7
3036
+
5 7 7 7 7
3037
+
3 7 7 7 7
3038
+
7 5 3 7 7
3039
+
5 5 3 7 7
3040
+
3 5 3 7 7
3041
+
7 1 3 7 7
3042
+
5 1 3 7 7
3043
+
3 1 3 7 7
3044
+
7 7 3 7 7
3045
+
5 7 3 7 7
3046
+
3 7 3 7 7
3047
+
7 5 2 9 9
3048
+
5 5 2 9 9
3049
+
3 5 2 9 9
3050
+
7 1 2 9 9
3051
+
5 1 2 9 9
3052
+
3 1 2 9 9
3053
+
7 7 2 9 9
3054
+
5 7 2 9 9
3055
+
3 7 2 9 9
3056
+
7 5 7 9 9
3057
+
5 5 7 9 9
3058
+
3 5 7 9 9
3059
+
7 1 7 9 9
3060
+
5 1 7 9 9
3061
+
3 1 7 9 9
3062
+
7 7 7 9 9
3063
+
5 7 7 9 9
3064
+
3 7 7 9 9
3065
+
7 5 3 9 9
3066
+
5 5 3 9 9
3067
+
3 5 3 9 9
3068
+
7 1 3 9 9
3069
+
5 1 3 9 9
3070
+
3 1 3 9 9
3071
+
7 7 3 9 9
3072
+
5 7 3 9 9
3073
+
3 7 3 9 9
3074
+
7 5 2 4 NULL
3075
+
5 5 2 4 NULL
3076
+
3 5 2 4 NULL
3077
+
7 1 2 4 NULL
3078
+
5 1 2 4 NULL
3079
+
3 1 2 4 NULL
3080
+
7 7 2 4 NULL
3081
+
5 7 2 4 NULL
3082
+
3 7 2 4 NULL
3083
+
7 5 7 4 NULL
3084
+
5 5 7 4 NULL
3085
+
3 5 7 4 NULL
3086
+
7 1 7 4 NULL
3087
+
5 1 7 4 NULL
3088
+
3 1 7 4 NULL
3089
+
7 7 7 4 NULL
3090
+
5 7 7 4 NULL
3091
+
3 7 7 4 NULL
3092
+
7 5 3 4 NULL
3093
+
5 5 3 4 NULL
3094
+
3 5 3 4 NULL
3095
+
7 1 3 4 NULL
3096
+
5 1 3 4 NULL
3097
+
3 1 3 4 NULL
3098
+
7 7 3 4 NULL
3099
+
5 7 3 4 NULL
3100
+
3 7 3 4 NULL
3101
+
7 5 2 5 NULL
3102
+
5 5 2 5 NULL
3103
+
3 5 2 5 NULL
3104
+
7 1 2 5 NULL
3105
+
5 1 2 5 NULL
3106
+
3 1 2 5 NULL
3107
+
7 7 2 5 NULL
3108
+
5 7 2 5 NULL
3109
+
3 7 2 5 NULL
3110
+
7 5 7 5 NULL
3111
+
5 5 7 5 NULL
3112
+
3 5 7 5 NULL
3113
+
7 1 7 5 NULL
3114
+
5 1 7 5 NULL
3115
+
3 1 7 5 NULL
3116
+
7 7 7 5 NULL
3117
+
5 7 7 5 NULL
3118
+
3 7 7 5 NULL
3119
+
7 5 3 5 NULL
3120
+
5 5 3 5 NULL
3121
+
3 5 3 5 NULL
3122
+
7 1 3 5 NULL
3123
+
5 1 3 5 NULL
3124
+
3 1 3 5 NULL
3125
+
7 7 3 5 NULL
3126
+
5 7 3 5 NULL
3127
+
3 7 3 5 NULL
3128
+
explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a, t5.a as t5_a
3129
+
from t1, t2 join t3 join t4 right join t5 on t4.a=t5.a;
3130
+
id select_type table type possible_keys key key_len ref rows filtered Extra
3131
+
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
3132
+
1 SIMPLE t5 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join)
3133
+
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
3134
+
1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
3135
+
1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join)
3136
+
Warnings:
3137
+
Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a`,`test`.`t5`.`a` AS `t5_a` from `test`.`t1` join `test`.`t5` left join (`test`.`t2` join `test`.`t3` join `test`.`t4`) on((`test`.`t4`.`a` = `test`.`t5`.`a`)) where 1
3138
+
select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a, t5.a as t5_a
3139
+
from t1, t2 join t3 join t4 right join t5 on t4.a=t5.a;
3140
+
t1_a t2_a t3_a t4_a t5_a
3141
+
7 5 2 7 7
3142
+
5 5 2 7 7
3143
+
3 5 2 7 7
3144
+
7 1 2 7 7
3145
+
5 1 2 7 7
3146
+
3 1 2 7 7
3147
+
7 7 2 7 7
3148
+
5 7 2 7 7
3149
+
3 7 2 7 7
3150
+
7 5 7 7 7
3151
+
5 5 7 7 7
3152
+
3 5 7 7 7
3153
+
7 1 7 7 7
3154
+
5 1 7 7 7
3155
+
3 1 7 7 7
3156
+
7 7 7 7 7
3157
+
5 7 7 7 7
3158
+
3 7 7 7 7
3159
+
7 5 3 7 7
3160
+
5 5 3 7 7
3161
+
3 5 3 7 7
3162
+
7 1 3 7 7
3163
+
5 1 3 7 7
3164
+
3 1 3 7 7
3165
+
7 7 3 7 7
3166
+
5 7 3 7 7
3167
+
3 7 3 7 7
3168
+
7 5 2 9 9
3169
+
5 5 2 9 9
3170
+
3 5 2 9 9
3171
+
7 1 2 9 9
3172
+
5 1 2 9 9
3173
+
3 1 2 9 9
3174
+
7 7 2 9 9
3175
+
5 7 2 9 9
3176
+
3 7 2 9 9
3177
+
7 5 7 9 9
3178
+
5 5 7 9 9
3179
+
3 5 7 9 9
3180
+
7 1 7 9 9
3181
+
5 1 7 9 9
3182
+
3 1 7 9 9
3183
+
7 7 7 9 9
3184
+
5 7 7 9 9
3185
+
3 7 7 9 9
3186
+
7 5 3 9 9
3187
+
5 5 3 9 9
3188
+
3 5 3 9 9
3189
+
7 1 3 9 9
3190
+
5 1 3 9 9
3191
+
3 1 3 9 9
3192
+
7 7 3 9 9
3193
+
5 7 3 9 9
3194
+
3 7 3 9 9
3195
+
7 NULL NULL NULL 3
3196
+
5 NULL NULL NULL 3
3197
+
3 NULL NULL NULL 3
3198
+
7 NULL NULL NULL 2
3199
+
5 NULL NULL NULL 2
3200
+
3 NULL NULL NULL 2
3201
+
explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a, t5.a as t5_a
3202
+
from t1 left join t2 on t1.a=t2.a, t3 join t4 right join t5 on t4.a=t5.a;
3203
+
id select_type table type possible_keys key key_len ref rows filtered Extra
3204
+
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
3205
+
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
3206
+
1 SIMPLE t5 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join)
3207
+
1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
3208
+
1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join)
3209
+
Warnings:
3210
+
Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a`,`test`.`t5`.`a` AS `t5_a` from `test`.`t1` left join `test`.`t2` on((`test`.`t2`.`a` = `test`.`t1`.`a`)) join `test`.`t5` left join (`test`.`t3` join `test`.`t4`) on((`test`.`t4`.`a` = `test`.`t5`.`a`)) where 1
3211
+
select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a, t5.a as t5_a
3212
+
from t1 left join t2 on t1.a=t2.a, t3 join t4 right join t5 on t4.a=t5.a;
0 commit comments