BUG #13973: Constants resolved in then/else clauses

From: harry(dot)townsend(at)eflowglobal(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #13973: Constants resolved in then/else clauses
Date: 2016-02-18 13:57:55
Message-ID: 20160218135755.2655.72680@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 13973
Logged by: Harry Townsend
Email address: harry(dot)townsend(at)eflowglobal(dot)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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2016-02-18 16:32:58 Re: aparent bug with pgAdmin version 1.22.1 connected to pg 9.5: SQL Pane view of SEQUENCE object
Previous Message Bruce Momjian 2016-02-18 13:49:40 Re: BUG #13963: pg_clusterupgrade and materialized view