[MDEV-15313] Error with aggregate function inside of last_value() window function Created: 2018-02-14  Updated: 2023-04-27

Status: Stalled
Project: MariaDB Server
Component/s: Optimizer - Window functions
Affects Version/s: 10.2, 10.3, 10.4
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Alice Sherepa Assignee: Sergei Petrunia
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates MDEV-19053 Error using first_value/last_value wi... Closed
Relates
relates to MDEV-11867 Invalid use of group function - Closed

 Description   

CREATE TABLE t(i int,j int);
INSERT INTO t VALUES (1,1), (1,5),(1,4), (2,2),(2,5), (3,3),(4,4);
INSERT INTO t VALUES (1,1), (1,5),(1,4), (2,2),(2,5), (3,3),(4,4);
SELECT i,  last_value(count(i)) OVER (partition BY i) FROM t GROUP BY i;

MariaDB [test]> SELECT i,  last_value(count(i)) OVER (partition by i) FROM t GROUP BY i;
ERROR 1111 (HY000): Invalid use of group function

PostgreSQL:
i last_value
1 6
2 4
3 2
4 2



 Comments   
Comment by Varun Gupta (Inactive) [ 2020-06-22 ]

Patch
http://lists.askmonty.org/pipermail/commits/2020-June/014271.html

Comment by Varun Gupta (Inactive) [ 2020-06-22 ]

This is a followup fix to MDEV-11867

Comment by Varun Gupta (Inactive) [ 2020-06-24 ]

igor looked at the patch and replied that he thinks that the patch does not look safe. So i need to investigate this further.

Generated at Thu Feb 08 08:20:19 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.