From: Tom Lane <tgl@sss.pgh.pa.us>
To: Leo Volin <lvolin@intelligentaudit.com>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: Case clause doesn't report syntactic error
Date: Sat, 14 Sep 2024 18:33:54 -0400
Message-ID: <700366.1726353234@sss.pgh.pa.us> (raw)
In-Reply-To: <DS0PR14MB71197DD699B2D10236D9059CA1662@DS0PR14MB7119.namprd14.prod.outlook.com>
References: <DS0PR14MB71197DD699B2D10236D9059CA1662@DS0PR14MB7119.namprd14.prod.outlook.com>
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
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 using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, lvolin@intelligentaudit.com, pgsql-bugs@lists.postgresql.org
Subject: Re: Case clause doesn't report syntactic error
In-Reply-To: <700366.1726353234@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