question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Recursive function DDL results in an infinite loop

See original GitHub issue
create type SomeThing {
   create link child -> SomeThing;
};

create function get_all_children_ordered(parent: SomeThing) -> SET OF SomeThing 
Using (SELECT SomeThing);

ALTER FUNCTION get_all_children_ordered(parent: SomeThing) USING ( SELECT parent.child UNION get_all_children_ordered(parent) );

results in

ERROR: InternalServerError: maximum recursion depth exceeded

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
elpranscommented, Jan 26, 2022

@adriangb, yes, the solution was to explicitly prohibit, which is better than crashing. Please open a new feature request if you’d like to see this implemented properly, ideally with some example use cases to help us better understand the need.

0reactions
adriangbcommented, Jan 26, 2022

Just to clarify: the solution here was to prohibit defining recursive functions temporarily until the feature is implemented? If so maybe best o keep the issue open, or is there any other way I can track progress on this actually getting implemented?

Read more comments on GitHub >

github_iconTop Results From Across the Web

15.00 - Preventing Infinite Recursion Due To Cyclic Data
Recursive views can recurse infinitely when there are cycles in the underlying data they are processing (as they can with acyclic data -...
Read more >
Finite and Infinite Recursion with examples - GeeksforGeeks
The process in which a function calls itself directly or indirectly is called Recursion and the corresponding function is called a Recursive ......
Read more >
recursive function going into infinite loop despite condition check
The proper fix is to use either a while loop or recursion (and then, probably return the value called by the recursive call)....
Read more >
Using recursive queries - Db2 for i SQL - IBM
Db2 for i provides two ways of defining a recursive query. ... If you want results back and just want the infinite cycle...
Read more >
4.8. Infinite Recursion — How to Think Like a Computer Scientist
In the examples in the previous section, notice that each time the functions get called recursively, the argument gets smaller by one, so...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found