This repository was archived by the owner on Mar 1, 2026. It is now read-only.
Commit f479bde
Chaithra Gopalareddy
Bug#33838439: ExtractValue not working properly with COUNT
If a derived table is implicitly grouped and if there is a condition
that could be pushed down to this table, it needs to be
pushed to the having clause of that derived table. However if the
condition does not have expressions involving columns from a table and
yet evaluates to a non const item, it is currently pushed to the
where clause. For an implicitly grouped query, if this where clause
evaluates to false, aggregation function results in a NULL. However if
it is evaluated as a having condition it will result in an empty set.
So the solution is to push conditions to the having clause instead of
where clause as the result of the where clause influences the result
of the aggregation function.
Change-Id: I948892cbe0390f1fdfddaa94661ff460da9359671 parent d77f156 commit f479bde
3 files changed
Lines changed: 45 additions & 6 deletions
File tree
- mysql-test
- r
- t
- sql
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1922 | 1922 | | |
1923 | 1923 | | |
1924 | 1924 | | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1195 | 1195 | | |
1196 | 1196 | | |
1197 | 1197 | | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1209 | 1209 | | |
1210 | 1210 | | |
1211 | 1211 | | |
1212 | | - | |
1213 | | - | |
1214 | | - | |
1215 | | - | |
1216 | | - | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
1217 | 1227 | | |
1218 | 1228 | | |
1219 | 1229 | | |
1220 | 1230 | | |
1221 | 1231 | | |
1222 | 1232 | | |
1223 | 1233 | | |
1224 | | - | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
1225 | 1237 | | |
1226 | 1238 | | |
1227 | 1239 | | |
| |||
0 commit comments