blob: ef0666564ea6efc0b1ea3007193627579593bad5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
## Changing the visibility of aliases entered in GROUP BY expr AS alias for WHERE {#group-by-expr-alias-where}
Since this version, in a query like
```yql
SELECT foo, ... WHERE foo = 1 GROUP BY expr AS foo
```
the value of foo in `WHERE` is taken from the original table, and not equal to `expr` as it was previously.
To get an error from the query if it changes behavior in this version, you need to add
```yql
PRAGMA FailOnGroupByExprOverride;
```
If you want to keep the previous behavior, you need to transform the query into this form:
```yql
SELECT foo, ... FROM (SELECT expr AS foo ...) WHERE foo = 1 GROUP BY foo
```
If you need to prepare the query for the transition to a new version, it is enough to remove the shadowing of the column name by the alias:
```yql
SELECT foo_new, ... WHERE foo = 1 GROUP BY expr AS foo_new
```
## TODO
|