On 2011-04-30, Jon Smark wrote:
> Hi,
>
> Does Postgresql perform short-circuit boolean evaluation both in SQL
> and PL/pgSQL functions?
sometimes.
the planner will rearrange what you write,
for this reason it is very likely that
> SELECT count(*) FROM foobar WHERE foobar.id = $1 AND do_s
David Johnston writes:
> No. It will not be called
> Or
> No. Postgresql does not short-circuit boolean evaluations
> ?
The correct answer is "maybe". See
http://www.postgresql.org/docs/9.0/static/sql-expressions.html#SYNTAX-EXPRESS-EVAL
regards, tom lane
--
Sent via p
On Sat, Apr 30, 2011 at 10:34:32AM -0400, David Johnston wrote:
> No. It will not be called
> Or
> No. Postgresql does not short-circuit boolean evaluations
> ?
SQL is a somewhat declarative language. There is no "order" to
evaluation as such. So you can't talk about short circuiting either.
This
No. It will not be called
Or
No. Postgresql does not short-circuit boolean evaluations
?
On Apr 30, 2011, at 10:27, pasman pasmański wrote:
> No.
>
> 2011/4/30, Jon Smark :
>> Hi,
>>
>> Does Postgresql perform short-circuit boolean evaluation both in SQL
>> and PL/pgSQL functions? As an examp
No.
2011/4/30, Jon Smark :
> Hi,
>
> Does Postgresql perform short-circuit boolean evaluation both in SQL
> and PL/pgSQL functions? As an example, suppose I have a function called
> "do_stuff" which is computationally intensive. In the example below,
> will it be called for rows for which the fi
Hi,
Does Postgresql perform short-circuit boolean evaluation both in SQL
and PL/pgSQL functions? As an example, suppose I have a function called
"do_stuff" which is computationally intensive. In the example below,
will it be called for rows for which the first predicate (foobar.id = $1)
is false