aboutsummaryrefslogtreecommitdiff
path: root/test/json103.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/json103.test')
-rw-r--r--test/json103.test20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/json103.test b/test/json103.test
index d7d12e337..35580ce4e 100644
--- a/test/json103.test
+++ b/test/json103.test
@@ -75,4 +75,24 @@ do_execsql_test json103-300 {
FROM t1;
} {{[1,"abc"]} {[{"x":1},{"x":"abc"}]}}
+# json_group_array() and json_group_object() work as window functions.
+#
+ifcapable windowfunc {
+ do_execsql_test json103-400 {
+ CREATE TABLE t4(x);
+ INSERT INTO t4 VALUES
+ (1),
+ ('a,b'),
+ (3),
+ ('x"y'),
+ (5),
+ (6),
+ (7);
+ SELECT json_group_array(x) OVER (ROWS 2 PRECEDING) FROM t4;
+ } {{[1]} {[1,"a,b"]} {[1,"a,b",3]} {["a,b",3,"x\"y"]} {[3,"x\"y",5]} {["x\"y",5,6]} {[5,6,7]}}
+ do_execsql_test json103-410 {
+ SELECT json_group_object(rowid, x) OVER (ROWS 2 PRECEDING) FROM t4;
+ } {{{"1":1}} {{"1":1,"2":"a,b"}} {{"1":1,"2":"a,b","3":3}} {{"2":"a,b","3":3,"4":"x\"y"}} {{"3":3,"4":"x\"y","5":5}} {{"4":"x\"y","5":5,"6":6}} {{"5":5,"6":6,"7":7}}}
+}
+
finish_test