Re: BUG #8568: PLPGSQL Documentation For CASE Is incorrect

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: joshuadburns(at)hotmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #8568: PLPGSQL Documentation For CASE Is incorrect
Date: 2013-10-30 00:19:23
Message-ID: 13624.1383092363@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

joshuadburns(at)hotmail(dot)com writes:
> Every example within the PLPGSQL "control structures" documentation states
> that the proper syntax for closing a "CASE" statement is to use "END CASE;"

Which it is.

> =====================================
> Example CASE statement with END CASE;
> -------------------------------------
> DO LANGUAGE "plpgsql" $BODY$
> DECLARE my_var INTEGER := 2; BEGIN
> RAISE NOTICE
> '%',
> CASE
> WHEN my_var = 1 THEN 'one'
> WHEN my_var = 2 THEN 'two'
> WHEN my_var = 3 THEN 'three'
> END CASE;
> END $BODY$;

This is not a case statement, it's a case expression (used within a RAISE
statement). That's documented under the main SQL grammar, and there
you just say END. Yeah, I know it's not terribly consistent.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David Johnston 2013-10-30 00:29:22 Re: BUG #8568: PLPGSQL Documentation For CASE Is incorrect
Previous Message joshuadburns 2013-10-30 00:07:37 BUG #8568: PLPGSQL Documentation For CASE Is incorrect