From: michael@aplaypowered.com
To: pgsql-bugs@postgresql.org
Subject: BUG #11661: CASE ELSE is evaluated although condition is true
Date: Mon, 13 Oct 2014 11:05:42 +0000
Message-ID: <20141013110542.25460.3900@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 11661
Logged by: Michael Stieler
Email address: michael@aplaypowered.com
PostgreSQL version: 9.2.6
Operating system: RHEL
Description:
I am not sure if it is a bug, a lack in documentation or just a
misunderstanding.
This issue refers to a StackOverflow question at
https://stackoverflow.com/questions/26297035/posgtres-case-condition-with-sum-aggregation-evaluates-...
The following query:
case when sum( column1 ) = 0
then 0
else round( sum( price
* hours
/ column1 ), 2 )
raises a division by zero error, although the condition sum(column1) = 0 is
true. I would expect that the else part would never be evaluated.
Documentation only describes that this happens for immediates.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-docs@postgresql.org
Cc: michael@aplaypowered.com, pgsql-bugs@postgresql.org
Subject: Re: BUG #11661: CASE ELSE is evaluated although condition is true
In-Reply-To: <20141013110542.25460.3900@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox