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

BUG #7574: CASE in WHERE condition change result set

From: urvancevav(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #7574: CASE in WHERE condition change result set
Date: 2012-09-28 08:58:42
Message-ID: E1THWPC-0005CT-UG@wrigleys.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged on the website:

Bug reference:      7574
Logged by:          Andrei
Email address:      urvancevav(at)gmail(dot)com
PostgreSQL version: 9.2.1
Operating system:   3.2.0-31-generic #50-Ubuntu SMP Fri Sep 7 16:16:45
Description:        

in query like this:
select
  departure0_.departure_id as departure1_87_,
-- a lot of other fields
-- ...
           case 
                when departure0_1_.departure_id is not null then 1 
                when departure0_.departure_id is not null then 0 
            end as clazz_ 
        from
            departure departure0_ 
        left outer join
            local_inv_departure departure0_1_ 
                on departure0_.departure_id=departure0_1_.departure_id 
        where
            case 
                when departure0_1_.departure_id is not null then 1 
                when departure0_.departure_id is not null then 0 
            end=0

CASE operator in the WHERE condition actually sets clazz_ to 0 instead of
filtering it.



Responses

pgsql-bugs by date

Next:From: Mikael KjellströmDate: 2012-09-28 14:09:47
Subject: Corrupt view in PostgreSQL 9.0.9
Previous:From: Alvaro HerreraDate: 2012-09-28 04:00:54
Subject: Re: BUG #7545: Unresponsive server with error log reporting: "poll() failed: Invalid argument"

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