Short-circuit boolean evaluation

From: Jon Smark <jon(dot)smark(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Short-circuit boolean evaluation
Date: 2011-04-30 13:58:31
Message-ID: 471279.1444.qm@web112813.mail.gq1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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?

SELECT count(*) FROM foobar WHERE foobar.id = $1 AND do_stuff (foobar.name);

Thanks!
Jon

Responses

Browse pgsql-general by date

  From Date Subject
Next Message pasman pasmański 2011-04-30 14:27:10 Re: Short-circuit boolean evaluation
Previous Message Greg Smith 2011-04-30 08:29:46 Re: Switching Database Engines