From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Susan Cassidy <susan(dot)cassidy(at)decisionsciencescorp(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: why does documentation use "END CASE" when that doesn't work |
Date: | 2014-02-26 00:43:47 |
Message-ID: | 4511.1393375427@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Susan Cassidy <susan(dot)cassidy(at)decisionsciencescorp(dot)com> writes:
> The documentation says:
> CASE search-expression
> WHEN expression [, expression [ ... ]] THEN
> statements
> [ WHEN expression [, expression [ ... ]] THEN
> statements
> ... ]
> [ ELSE
> statements ]
> END CASE;
> And it repeats the "END CASE" phrase in other examples.
> However, that doesn't work. You have to just use "END".
> Shouldn't the documentation be fixed?
No ... you're confusing the SQL CASE expression with the plpgsql CASE
statement.
http://www.postgresql.org/docs/9.3/static/functions-conditional.html
http://www.postgresql.org/docs/9.3/static/plpgsql-control-structures.html#PLPGSQL-CONDITIONALS
It's a bit unfortunate that plpgsql's statement looks enough like the
expression to cause confusion, yet not exactly like the expression.
The decorated END is consistent with other things in plpgsql such as
END IF, though.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Jov | 2014-02-26 01:09:52 | Re: why does documentation use "END CASE" when that doesn't work |
Previous Message | Susan Cassidy | 2014-02-26 00:29:25 | why does documentation use "END CASE" when that doesn't work |