From: Tom Lane <tgl@sss.pgh.pa.us>
To: joshuadburns@hotmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #8568: PLPGSQL Documentation For CASE Is incorrect
Date: Tue, 29 Oct 2013 20:19:23 -0400
Message-ID: <13624.1383092363@sss.pgh.pa.us> (raw)
In-Reply-To: <E1VbJJx-0003T6-KN@wrigleys.postgresql.org>
References: <E1VbJJx-0003T6-KN@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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: tgl@sss.pgh.pa.us, joshuadburns@hotmail.com
Subject: Re: BUG #8568: PLPGSQL Documentation For CASE Is incorrect
In-Reply-To: <13624.1383092363@sss.pgh.pa.us>
References: <E1VbJJx-0003T6-KN@wrigleys.postgresql.org> <13624.1383092363@sss.pgh.pa.us>
* 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