Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1THWPE-0001AD-V2 for pgsql-bugs@postgresql.org; Fri, 28 Sep 2012 08:58:45 +0000 Received: from mahout.postgresql.org ([98.129.198.123]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1THWPE-0000gs-4u for pgsql-bugs@postgresql.org; Fri, 28 Sep 2012 08:58:44 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1THWPD-0005Ll-JP for pgsql-bugs@postgresql.org; Fri, 28 Sep 2012 08:58:44 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1THWPC-0005CT-UG for pgsql-bugs@postgresql.org; Fri, 28 Sep 2012 08:58:42 +0000 Date: Fri, 28 Sep 2012 08:58:42 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #7574: CASE in WHERE condition change result set To: pgsql-bugs@postgresql.org From: urvancevav@gmail.com X-Pg-Spam-Score: -2.7 (--) X-Archive-Number: 201209/296 X-Sequence-Number: 34290 The following bug has been logged on the website: Bug reference: 7574 Logged by: Andrei Email address: urvancevav@gmail.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=3Ddeparture0_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=3D0 CASE operator in the WHERE condition actually sets clazz_ to 0 instead of filtering it.