> Is there a way I could programatically determine that a query is non- > deterministic at query prepare time?
What do you mean, non-deterministic? The result is deterministic in all cases. It may be complicated and/or difficult for you to compute, but it is always deterministic. The result is generated by running an unchanging algorithm on unchanging data. If there is no random inputs and the computer hardware is not broken, then the results are entirely determined by the algorithm executed and the state of the data upon which it is operating.