From: | "Joel Burton" <joel(at)joelburton(dot)com> |
---|---|
To: | "Alessio Bragadini" <alessio(at)albourne(dot)com>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: wierd AND condition evaluation for plpgsql |
Date: | 2002-05-30 13:21:17 |
Message-ID: | JGEPJNMCKODMDHGOBKDNCENICPAA.joel@joelburton.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> -----Original Message-----
> From: pgsql-hackers-owner(at)postgresql(dot)org
> [mailto:pgsql-hackers-owner(at)postgresql(dot)org]On Behalf Of Alessio
> Bragadini
> Sent: Thursday, May 30, 2002 9:04 AM
> To: PostgreSQL Hackers
> Subject: Re: [HACKERS] wierd AND condition evaluation for plpgsql
>
>
> On Tue, 2002-05-28 at 16:09, Joel Burton wrote:
>
> > Actually, at least in some cases, PG does short-circuit logic:
>
> > joel(at)joel=# select false and seeme();
>
> > joel(at)joel=# select true and seeme();
>
> If seeme() returns NULL, shouldn't both SELECTs return NULL, and
> therefore not be short-circuit-able?
>
> Sorry, I am a little confused.
In my example, seeme() returns true, not NULL. However, the short-circuiting
came from the other part (the simple true or false) being evaluated first.
So, regardless of the returned value of seeme(), "SELECT FALSE AND seeme()"
would short-circuit, since "FALSE AND ___" can never be true. Of course, if
seemme() returns NULL, then the end result would be false.
- J.
Joel BURTON | joel(at)joelburton(dot)com | joelburton.com | aim: wjoelburton
Knowledge Management & Technology Consultant
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-05-30 13:57:25 | Re: Null values in indexes |
Previous Message | Alessio Bragadini | 2002-05-30 13:04:19 | Re: wierd AND condition evaluation for plpgsql |