-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit adds tests for the `ExtractTailCalls` function from the previous commit, and adds a `tail-call` field to `UDFCall` expressions that are in tail-call position in another routine. It also adds a regression test for cockroachdb#120916. Informs cockroachdb#120916 Release note: None
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# LogicTest: !local-mixed-23.1 !local-mixed-23.2 | ||
|
||
# Regression test for #120916 - the nested routine is not in tail-call position, | ||
# and so cannot be a target for TCO. | ||
statement ok | ||
CREATE FUNCTION f_nested(x INT) RETURNS INT AS $$ | ||
BEGIN | ||
x := x * 2; | ||
RETURN x; | ||
END | ||
$$ LANGUAGE PLpgSQL; | ||
|
||
statement ok | ||
CREATE FUNCTION f() RETURNS RECORD AS $$ | ||
DECLARE | ||
a INT := -2; | ||
BEGIN | ||
a := f_nested(a); | ||
RAISE NOTICE 'here'; | ||
RETURN (a, -a); | ||
END | ||
$$ LANGUAGE PLpgSQL; | ||
|
||
query II | ||
SELECT * FROM f() AS g(x INT, y INT); | ||
---- | ||
-4 4 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.