pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: harry.townsend@eflowglobal.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #13973: Constants resolved in then/else clauses
Date: Thu, 18 Feb 2016 13:50:52 -0300
Message-ID: <20160218165052.GA952091@alvherre.pgsql> (raw)
In-Reply-To: <20160218135755.2655.72680@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

harry.townsend@eflowglobal.com wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      13973
> Logged by:          Harry Townsend
> Email address:      harry.townsend@eflowglobal.com
> PostgreSQL version: 9.1.20
> Operating system:   Windows Server 2008
> Description:        
> 
> I attempted to create a safety check in a query using a "case when"
> statement such that if the condition evaluated to false, it would return (1
> / 0) in order to nullify the entire transaction. With small conditions, this
> works fine. With larger ones, it seems that the constants in the "else"
> clause (didn't test for "then" clause) are evaluated before the condition,
> causing it to fail every time. If the "else" part requires a column value,
> it seems to force the condition to evaluate first though.

Can you show a complete example?

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (4+ messages)  latest in thread

Message-ID: <20160218165052.GA952091@alvherre.pgsql>
Permalink:  ../20160218165052.GA952091@alvherre.pgsql/
Also on:    postgresql.org/message-id/20160218165052.GA952091@alvherre.pgsql

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: alvherre@2ndquadrant.com, harry.townsend@eflowglobal.com
  Subject: Re: BUG #13973: Constants resolved in then/else clauses
  In-Reply-To: <20160218165052.GA952091@alvherre.pgsql>
  References: <20160218135755.2655.72680@wrigleys.postgresql.org> <20160218165052.GA952091@alvherre.pgsql>

* 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