Add test case for Issue #16
authorPallavi Sontakke <[email protected]>
Fri, 15 Jul 2016 10:48:39 +0000 (16:18 +0530)
committerPallavi Sontakke <[email protected]>
Fri, 15 Jul 2016 10:48:39 +0000 (16:18 +0530)
src/test/regress/expected/xl_reported_bugs.out [new file with mode: 0644]
src/test/regress/sql/xl_reported_bugs.sql [new file with mode: 0644]

diff --git a/src/test/regress/expected/xl_reported_bugs.out b/src/test/regress/expected/xl_reported_bugs.out
new file mode 100644 (file)
index 0000000..bacaa4b
--- /dev/null
@@ -0,0 +1,17 @@
+-- #16
+-- Windowing function throws an error when subquery has ORDER BY clause
+CREATE TABLE test (a int, b int);
+EXPLAIN SELECT last_value(a) OVER (PARTITION by b) FROM (SELECT * FROM test) AS s ORDER BY a;
+                                              QUERY PLAN                                               
+-------------------------------------------------------------------------------------------------------
+ Sort  (cost=192.41..198.06 rows=2260 width=8)
+   Sort Key: test.a
+   ->  WindowAgg  (cost=0.00..66.50 rows=2260 width=8)
+         ->  Remote Subquery Scan on all (datanode_1,datanode_2)  (cost=0.00..32.60 rows=2260 width=8)
+               ->  Sort  (cost=158.51..164.16 rows=2260 width=8)
+                     Sort Key: test.b
+                     ->  Seq Scan on test  (cost=0.00..32.60 rows=2260 width=8)
+(7 rows)
+
+EXPLAIN SELECT last_value(a) OVER (PARTITION by b) FROM (SELECT * FROM test  ORDER BY a) AS s ORDER BY a;
+DROP TABLE test;
diff --git a/src/test/regress/sql/xl_reported_bugs.sql b/src/test/regress/sql/xl_reported_bugs.sql
new file mode 100644 (file)
index 0000000..5b3b609
--- /dev/null
@@ -0,0 +1,6 @@
+-- #16
+-- Windowing function throws an error when subquery has ORDER BY clause
+CREATE TABLE test (a int, b int);
+EXPLAIN SELECT last_value(a) OVER (PARTITION by b) FROM (SELECT * FROM test) AS s ORDER BY a;
+EXPLAIN SELECT last_value(a) OVER (PARTITION by b) FROM (SELECT * FROM test  ORDER BY a) AS s ORDER BY a;
+DROP TABLE test;