Re: BUG #8568: PLPGSQL Documentation For CASE Is incorrect - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #8568: PLPGSQL Documentation For CASE Is incorrect
Date
Msg-id 13624.1383092363@sss.pgh.pa.us
Whole thread Raw
In response to BUG #8568: PLPGSQL Documentation For CASE Is incorrect  (joshuadburns@hotmail.com)
List pgsql-bugs
joshuadburns@hotmail.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

pgsql-bugs by date:

Previous
From: joshuadburns@hotmail.com
Date:
Subject: BUG #8568: PLPGSQL Documentation For CASE Is incorrect
Next
From: David Johnston
Date:
Subject: Re: BUG #8568: PLPGSQL Documentation For CASE Is incorrect