wording for 38.6.2.4. Simple CASE and 38.6.2.5. Searched CASE

Поиск
Список
Период
Сортировка
От Andreas Wenk
Тема wording for 38.6.2.4. Simple CASE and 38.6.2.5. Searched CASE
Дата
Msg-id 4A85D211.8000604@netzmeister-st-pauli.de
обсуждение исходный текст
Ответы Re: wording for 38.6.2.4. Simple CASE and 38.6.2.5. Searched CASE  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-docs
Hi,

I find it a little confusing how 38.6.2.4. Simple CASE and 38.6.2.5.
Searched CASE is described. In Simple CASE is written

CASE search-expression
    WHEN expression [,

and in 38.6.2.5. Searched CASE is written

CASE
    WHEN boolean-expression

IMO speaking of a search-expression for the simple CASE and speaking of
a boolean-expression in between Searched Case is confusing because of
the use of the word "search". I would change it to that:

[snip]
38.6.2.4. Simple CASE

CASE
     WHEN boolean-expression THEN
       statements
   [ WHEN boolean-expression THEN
       statements
     ... ]
   [ ELSE
       statements ]
END CASE;

The simple form of CASE provides conditional execution based on truth of
boolean expressions. Each WHEN clause's boolean-expression is evaluated
in turn, until one is found that yields true. Then the corresponding
statements are executed, and then control passes to the next statement
after END CASE. (Subsequent WHEN expressions are not evaluated.) If no
true result is found, the ELSE statements are executed; but if ELSE is
not present, then a CASE_NOT_FOUND exception is raised.

[EXAMPLE ...]

38.6.2.5. Searched CASE

CASE search-expression
     WHEN expression [, expression [ ... ]] THEN
       statements
   [ WHEN expression [, expression [ ... ]] THEN
       statements
     ... ]
   [ ELSE
       statements ]
END CASE;

The searched form of CASE provides conditional execution based on
equality of operands. The search-expression is evaluated (once) and
successively compared to each expression in the WHEN clauses. If a match
is found, then the corresponding statements are executed, and then
control passes to the next statement after END CASE. (Subsequent WHEN
expressions are not evaluated.) If no match is found, the ELSE
statements are executed; but if ELSE is not present, then a
CASE_NOT_FOUND exception is raised.

[EXAMPLE ...]

[snip]

I moved 38.6.2.5 to 38.6.2.4 and changed the naming ...

Thoughts?

Cheers

Andy

В списке pgsql-docs по дате отправления:

Предыдущее
От: Josh Berkus
Дата:
Сообщение: pl/perl doc correction: subroutines
Следующее
От: Tom Lane
Дата:
Сообщение: Re: wording for 38.6.2.4. Simple CASE and 38.6.2.5. Searched CASE