News for hackers. Stuff that matters.
Re:Solving the 1+N Query Problem by vilterp on Tuesday August 25, 2026 @01:48PM (#49437826)
> [Datalog] is a subset of Prolog that lacks recursion

Datalog does allow for recursion — a common example is graph reachability:

reachable(a, b) :- edge(a, b). reachable(a, c) :- edge(a, b), reachable(b, c).

(Evan mentioned implementing kCFA, which would require recursion like this...)

'Base datalog' guarantees termination by requiring all input relations to be finite. Notably this means that it doesn't have numerical operations like addition or multiplication, since `plus(a, b)` or `times(a, b)` would be infinite relations.

More practical Datalog engines like Souffle (https://souffle-lang.github.io/) have numerical operations but don't guarantee termination.

Recursive queries are not needed by most applications, but maybe Acadia could allow them (compiling to recursive CTEs) by proving that recursion only goes through finite relations.

Re:Solving the 1+N Query Problem by cryptonector on Tuesday August 25, 2026 @03:58PM (#49439766)
If you can do Peano numbers...

Guaranteed termination isn't really if you give me enough rope to implement the Ackermann function.

Re:Solving the 1+N Query Problem by debugnik on Tuesday August 25, 2026 @09:43PM (#49443164)
Pure Datalog can't express peano up to infinity, its terms can't be functors as in Prolog. At best you could hardcode a successor relation up to a limit.