diff --git a/tests/yast.test/tabfunc1.test b/tests/yast.test/tabfunc1.test new file mode 100644 index 0000000000..e3d00ae777 --- /dev/null +++ b/tests/yast.test/tabfunc1.test @@ -0,0 +1,52 @@ +# This file implements tests for table-valued-functions implemented using +# eponymous virtual tables. + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +# Ticket 174827501 +do_test tabfunc01-100 { + db eval { + select * + from ( + values + (1, '{"x":1}'), + (2, '{"x":1, "y": 2}') + ) + left join json_each(column2, '$.y') y; + } +} {1 {{"x":1}} {} {} {} {} {} {} {} {} 2 {{"x":1, "y": 2}} {} 2 integer 2 4 {} {$.y} {$.y}} + +# Ticket 174827501 +do_test tabfunc01-101 { + db eval { + select * from + generate_series(1, 2) a + left join generate_series(2, 3) b + on a.value=b.value; + } +} {1 {} 2 2} + +# Ticket 174827501 +do_test tabfunc01-102 { + db eval { + create table a(value int); + insert into a(value) values(1), (2); + select * from a + left join generate_series(2, 3) b + on a.value=b.value; + } +} {1 {} 2 2} + +# Ticket 174827501 +do_test tabfunc01-103 { + db eval { + create table b(value int); + insert into b(value) values(2), (3); + select * from generate_series(1, 2) a + left join b + on a.value=b.value; + } +} {1 {} 2 2} + +finish_test