Skip site navigation (1) Skip section navigation (2)

Bug #633: CASE statement evaluation does not short-circut

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #633: CASE statement evaluation does not short-circut
Date: 2002-04-14 16:52:22
Message-ID: 20020414165222.914FB475451@postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-hackers
James Cole (colejatmsu.edu) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
CASE statement evaluation does not short-circut

Long Description
In 7.2.1, Both the WHEN and THEN clauses of a CASE statement are evaluated, even if the WHEN clause evaluates to FALSE.

(I'm not sure if this behavior is allowed by the '92 spec, but  it's different than under 7.1.x)

Platform info:
joel2=# select version();
                             version                              
------------------------------------------------------------------
 PostgreSQL 7.2.1 on sparc-sun-solaris2.6, compiled by GCC 2.95.2
(1 row)


Sample Code
joel2=# 
SELECT
    CASE
        WHEN 1 = 2 THEN 1 / 0
        WHEN 1 = 1 THEN 1.0
    END;
ERROR:  floating point exception! The last floating point operation either exceeded legal ranges or was a divide by zero


No file was uploaded with this report


Responses

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2002-04-14 16:52:53
Subject: Re: 7.2 crash...
Previous:From: Bruce MomjianDate: 2002-04-14 14:38:06
Subject: Re: Again, sorry, caching.

pgsql-bugs by date

Next:From: Bruce MomjianDate: 2002-04-14 16:52:53
Subject: Re: 7.2 crash...
Previous:From: Grégory BécueDate: 2002-04-14 11:37:59
Subject: Problem Modify

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group