BUG #11944: plpgsql if-case-then syntax error.

From: jasen(at)treshna(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #11944: plpgsql if-case-then syntax error.
Date: 2014-11-12 04:46:44
Message-ID: 20141112044644.2524.61080@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: 11944
Logged by: Jasen Betts
Email address: jasen(at)treshna(dot)com
PostgreSQL version: 9.1.13
Operating system: linux
Description:

this does work

create function fails( a int) returns int language plpgsql as $$ begin
if CASE when a = 1 then true else false END
then return 1; else return 0; end if ;
end $$;

parentheses can make it work.

create function fails_not( a int) returns int language plpgsql as $$ begin
if ( CASE when a = 1 then true else false END )
then return 1; else return 0; end if ;
end $$;

It seems to be the plpgsql parser not treating the CASE-END as atomic when
looking for the end of the IF xpression.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message ipnb87 2014-11-12 09:16:31 BUG #11948: Error when installing PostgreSQL 9.3 server
Previous Message Tom Lane 2014-11-11 22:23:49 Re: BUG #11905: "Error: Wrong key or corrupt data" with pgp_sym_decrypt when bytea size is 2^x - 6 where x >=14