polardbxengine/mysql-test/r/window_functions_myisam.result

37 lines
1.5 KiB
Plaintext

Bug with constant table: MYISAM makes ot a constant table when it has one row
CREATE TABLE ot (i int) ENGINE=MYISAM;
CREATE FUNCTION f(a INTEGER) RETURNS INTEGER DETERMINISTIC RETURN a*a;
Empty table did work before
SELECT ROW_NUMBER() OVER () , BIT_AND(i) FROM ot WHERE f(2)<2;
ROW_NUMBER() OVER () BIT_AND(i)
1 18446744073709551615
SELECT ROW_NUMBER() OVER () AS RN, BIT_AND(i) AS x FROM ot WHERE f(2) < 2 HAVING x < 2;
RN x
SELECT SUM(BIT_AND(i)) OVER (ORDER BY BIT_AND(i)) , BIT_AND(i) FROM ot WHERE f(2)<2;
SUM(BIT_AND(i)) OVER (ORDER BY BIT_AND(i)) BIT_AND(i)
18446744073709551615 18446744073709551615
INSERT INTO ot VALUES (1);
One row in table: used to be wrong before fix:
SELECT ROW_NUMBER() OVER () , BIT_AND(i) FROM ot WHERE f(2)<2;
ROW_NUMBER() OVER () BIT_AND(i)
1 18446744073709551615
SELECT ROW_NUMBER() OVER () AS RN, BIT_AND(i) AS x FROM ot WHERE f(2) < 2 HAVING x < 2;
RN x
SELECT SUM(BIT_AND(i)) OVER (ORDER BY BIT_AND(i)) , BIT_AND(i) FROM ot WHERE f(2)<2;
SUM(BIT_AND(i)) OVER (ORDER BY BIT_AND(i)) BIT_AND(i)
18446744073709551615 18446744073709551615
INSERT INTO ot VALUES (1);
Two rows in table did work before
SELECT ROW_NUMBER() OVER () , BIT_AND(i) FROM ot WHERE f(2)<2;
ROW_NUMBER() OVER () BIT_AND(i)
1 18446744073709551615
SELECT ROW_NUMBER() OVER () AS RN, BIT_AND(i) AS x FROM ot WHERE f(2) < 2 HAVING x < 2;
RN x
SELECT SUM(BIT_AND(i)) OVER (ORDER BY BIT_AND(i)) , BIT_AND(i) FROM ot WHERE f(2)<2;
SUM(BIT_AND(i)) OVER (ORDER BY BIT_AND(i)) BIT_AND(i)
18446744073709551615 18446744073709551615
DROP TABLE ot;
DROP FUNCTION f;