Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

Re: wording for 38.6.2.4. Simple CASE and 38.6.2.5. Searched CASE


  • From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
  • To: Andreas Wenk <a(dot)wenk(at)netzmeister-st-pauli(dot)de>
  • Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-docs(at)postgresql(dot)org
  • Subject: Re: wording for 38.6.2.4. Simple CASE and 38.6.2.5. Searched CASE
  • Date: Mon, 17 Aug 2009 12:10:10 -0400
  • Message-id: <20090817161010.GC4782@alvh.no-ip.org> <text/plain>

Andreas Wenk wrote:
> Tom Lane wrote:
> >Hmm, it would be important to keep this in sync with the core-SQL
> >description of CASE, no?  (Section 9.16.1)
> 
> yes. And there is written "general" form and "simple" form. I like that.
> 
> >I can't say that I think "simple CASE" and "searched CASE" are good
> >descriptions of the two forms, but just switching them doesn't make it
> >much better.  And doing so would likely create as much confusion as
> >it eliminates.  Can we come up with some other phrases?
> 
> IMO it should be the same like in 9.16.1 - a "general" form and a
> "simple" form. Then changing both sections would be ok, because in
> 9.16.1 the simple form is mentioned after the general form.

"simple case" and "searched case" is SQL/PSM's terminology.  I'm not
sure it's necessarily a good idea to deviate from that.  See SQL part 4,
13.6 <case statement>:

Function
Provide conditional execution based on truth of <search condition>s or on equality of operands.

Format
<case statement> ::=
    <simple case statement>
  | <searched case statement>
<simple case statement> ::=
    CASE <case operand>
    <simple case statement when clause>...
    [ <case statement else clause> ]
    END CASE
<searched case statement> ::=
    CASE <searched case statement when clause>...
    [ <case statement else clause> ]
    END CASE
<simple case statement when clause> ::=
    WHEN <when operand list>
    THEN <SQL statement list>
<searched case statement when clause> ::=
    WHEN <search condition>
    THEN <SQL statement list>
<case statement else clause> ::= ELSE <SQL statement list>


-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group