Skip to content

Commit

Permalink
Add table valued function tests
Browse files Browse the repository at this point in the history
Signed-off-by: Morgan Douglas <mdouglas47@bloomberg.net>
  • Loading branch information
morgando committed Apr 25, 2024
1 parent 01d7076 commit 58e5124
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions tests/yast.test/tabfunc1.test
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 58e5124

Please sign in to comment.