|
1 | 1 | drop table if exists t1,t2;
|
| 2 | +# ######################################################################## |
| 3 | +# # Parser tests |
| 4 | +# ######################################################################## |
2 | 5 | #
|
3 | 6 | # Check what happens when one attempts to use window function without OVER clause
|
4 |
| -# |
5 | 7 | create table t1 (a int, b int);
|
6 | 8 | insert into t1 values (1,1),(2,2);
|
7 | 9 | select row_number() from t1;
|
8 | 10 | ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'from t1' at line 1
|
9 | 11 | select rank() from t1;
|
10 | 12 | ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'from t1' at line 1
|
| 13 | +# Attempt to use window function in the WHERE clause |
| 14 | +select * from t1 where 1=rank() over (order by a); |
| 15 | +ERROR HY000: Invalid use of group function |
| 16 | +select * from t1 where 1>row_number() over (partition by b order by a); |
| 17 | +ERROR HY000: Invalid use of group function |
11 | 18 | drop table t1;
|
| 19 | +# ######################################################################## |
| 20 | +# # Functionality tests |
| 21 | +# ######################################################################## |
12 | 22 | #
|
13 |
| -# Check if basic window functions work |
14 |
| -# |
| 23 | +# Check if ROW_NUMBER() works in basic cases |
15 | 24 | create table t1(a int, b int, x char(32));
|
16 | 25 | insert into t1 values (2, 10, 'xx');
|
17 | 26 | insert into t1 values (2, 10, 'zz');
|
|
0 commit comments