[GENERAL] Short circuit evaluation of expressions in query

2006-06-13 Thread Jimmy Choi
Say I have the following parameterized query in a function: select * from foo where ($1 = -1 or foo.status = $1) and () where the () part consists of more parameterized conditions similar to the first one. Suppose that at runtime, $1 is supplied a value of -1, does the foo.status

Re: [GENERAL] Short circuit evaluation of expressions in query

2006-06-13 Thread Martijn van Oosterhout
On Tue, Jun 13, 2006 at 02:34:36PM -0400, Jimmy Choi wrote: Suppose that at runtime, $1 is supplied a value of -1, does the foo.status = $1 condition still have to be evaluated? SQL doesn't offer any kind of guarentees about order of evaluations, and neither does postgres. It may occasionally

Re: [GENERAL] Short circuit evaluation of expressions in query

2006-06-13 Thread Tom Lane
Jimmy Choi [EMAIL PROTECTED] writes: Say I have the following parameterized query in a function: select * from foo where ($1 = -1 or foo.status = $1) and (...) Suppose that at runtime, $1 is supplied a value of -1, does the foo.status = $1 condition still have to be evaluated? The PG manual