Re: Case clause doesn't report syntactic error - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Case clause doesn't report syntactic error
Date
Msg-id 700366.1726353234@sss.pgh.pa.us
Whole thread Raw
List pgsql-bugs
Leo Volin <lvolin@intelligentaudit.com> writes:
> This generates no error:
> select case '4'::int when 1 then 1 when 4 then 11 else 2 end;
> (prints 11)
> It doesn't match the documented format:
> CASE WHEN condition THEN result
>      [WHEN ...]
>      [ELSE result]
> END

You need to read down a couple of paragraphs to where the
"simple" variant of CASE is explained [1]:

CASE expression
    WHEN value THEN result
    [WHEN ...]
    [ELSE result]
END

Perhaps we should rearrange that page so both syntax variants
appear at the top; but it's not wrong.

            regards, tom lane

[1] https://www.postgresql.org/docs/current/functions-conditional.html#FUNCTIONS-CASE



pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Case clause doesn't report syntactic error
Next
From: PG Bug reporting form
Date:
Subject: BUG #18618: pg_upgrade from 14 to 15+ fails for unlogged table with identity column