Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
Description
Window functions: catch invalid window frame specs
The standard specifies a lot of restrictions around frame definitions. We catch
some, check
ERROR HY000: Unacceptable combination of window frame bound specifications
|
in win.result, but not all. Things like
"rows between 1.5 preceding and 'foo' following"
are still allowed and cause assertion failures.
Attachments
Issue Links
- is part of
-
MDEV-6115 window functions as in the SQL standard
-
- Closed
-
- relates to
-
MDEV-19052 Range-type window frame supports only numeric datatype
-
- Closed
-
Activity
Fix Version/s | N/A [ 14700 ] | |
Fix Version/s | 10.2 [ 14601 ] | |
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Component/s | Optimizer - Window functions [ 13502 ] | |
Component/s | Optimizer [ 10200 ] |
Workflow | MariaDB v3 [ 74567 ] | MariaDB v4 [ 132810 ] |
Link |
This issue relates to |
The standard, section 6.10, <window function>.
syntax rules says:
select rank() over (partition by a order by (select max(a) from t2 ) from ten;
select rank() over (partition by a) from ten;
select rank() over (order by a rows between 1 preceding and 1 following) from ten;
MariaDB: ok (framing ignored)
PG: Ok (framing ignored)
Oracle: ORA-00907: missing right parenthesis
MS SQL: The function 'rank' may not have a window frame.
ORA-30486: invalid window aggregation group in the window specification
create table t1 (a int, b int, c int);
insert into t1 values (1,1,1);
insert into t1 values (2,2,2);
select count(*) over (order by a,b range between unbounded preceding and
current row) from t1;
PG, MS-SQL: ok
Oracle: ORA-30486: invalid window aggregation group in the window specification
MariaDB: crash.
create table t1 (a varchar(32), b int, c int);
insert into t1 values ('aaa',1,1);
insert into t1 values ('bbbb',2,2);
select count(*) over (order by a range between unbounded preceding and
current row) from t1;
PG, MS-SQL: OK
Oracle: OK
Oracle, with "1 PRECEDING": "ORA-00902: invalid datatype"
MariaDB: crash.
select count(*) over (rows between -1 preceding and current row ) from t1;
MariaDB: handled by the parser. One gets "Integer is required for ROWS-type frame" error.
PG: ERROR: frame starting offset must not be negative
MS-SQL: Incorrect syntax near 'rows'.
Oracle: No error