views:

77

answers:

2

Is it possible to incur a infinite loop through the creation of a Boolean query (e.g. Library catalog or google search)?

A: 

I'm not sure exactly what you mean by "Boolean query" (that is a pretty broad term), but if you simply mean, any expression in any language that evaluates to true or false, then I'd have to say yes.

I mean, what about something like this pseudo-code:

bool x = this() OR that()

function this()
    return that()

function that()
    return this()

That is to say, infinite recursion will always be possible if method calls are involved, assuming an infinitely recursive method is a potentiality in the programming language in question.

Or is that not what you meant?

Dan Tao
A: 

The only common situation I can think of where infinite looping is not possible is where you have a language with a series of instructions, and it is impossible, once you have executed an instruction, to go to a previous instruction (or to repeat the current one). It might be that SQL does this sort of thing on a per-row basis, so infinite looping is impossible.

WhirlWind
Not `standard` SQL, but note that (MS)SQL-Server provides `while`: http://stackoverflow.com/questions/2456330/how-to-organize-infinite-while-loop-in-sql-server
ChristopheD