summaryrefslogtreecommitdiff
path: root/mysql-test/main/win_percentile.test
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2020-06-01 14:30:21 +0400
committerAlexander Barkov <bar@mariadb.com>2020-06-01 14:30:21 +0400
commit33b839b2e767775d2345caf73ff4eecd155f0518 (patch)
tree18a756b58418f26e7a05a8745344c946afa8c6a2 /mysql-test/main/win_percentile.test
parentf22093ad392b6a7c9906ff97551fc9e1eda8ffa7 (diff)
downloadmariadb-git-33b839b2e767775d2345caf73ff4eecd155f0518.tar.gz
MDEV-20280 PERCENTILE_DISC() rejects temporal and string input
Diffstat (limited to 'mysql-test/main/win_percentile.test')
-rw-r--r--mysql-test/main/win_percentile.test11
1 files changed, 8 insertions, 3 deletions
diff --git a/mysql-test/main/win_percentile.test b/mysql-test/main/win_percentile.test
index 8705be123ff..e981dc62c41 100644
--- a/mysql-test/main/win_percentile.test
+++ b/mysql-test/main/win_percentile.test
@@ -61,7 +61,7 @@ select name from t1 a where (select percentile_disc(0.5) within group (order by
--echo #disallowed fields in order by
--error ER_WRONG_TYPE_FOR_PERCENTILE_FUNC
select score, percentile_cont(0.5) within group(order by name) over (partition by score) from t1;
---error ER_WRONG_TYPE_FOR_PERCENTILE_FUNC
+
select score, percentile_disc(0.5) within group(order by name) over (partition by score) from t1;
--echo #parameter value should be in the range of [0,1]
@@ -212,7 +212,7 @@ DROP TABLE t2, t1;
--echo #
---echo # MDEV-20272 PERCENTILE_DISC() crashes on a temporal type input
+--echo # MDEV-20280 PERCENTILE_DISC() rejects temporal and string input
--echo #
CREATE OR REPLACE TABLE t1 (name CHAR(30), star_rating TIME);
@@ -221,8 +221,13 @@ INSERT INTO t1 VALUES ('Lord of the Ladybirds', 3);
INSERT INTO t1 VALUES ('Lady of the Flies', 1);
INSERT INTO t1 VALUES ('Lady of the Flies', 2);
INSERT INTO t1 VALUES ('Lady of the Flies', 5);
---error ER_WRONG_TYPE_FOR_PERCENTILE_FUNC
SELECT name, PERCENTILE_DISC(0.5)
WITHIN GROUP (ORDER BY star_rating)
OVER (PARTITION BY name) AS pc FROM t1;
+SELECT name, PERCENTILE_DISC(0)
+ WITHIN GROUP (ORDER BY star_rating)
+ OVER (PARTITION BY name) AS pc FROM t1;
+SELECT name, PERCENTILE_DISC(1)
+ WITHIN GROUP (ORDER BY star_rating)
+ OVER (PARTITION BY name) AS pc FROM t1;
DROP TABLE t1;