Re: IN clause behaving badly with missing comma and line break - Mailing list pgsql-bugs

From David Rowley
Subject Re: IN clause behaving badly with missing comma and line break
Date
Msg-id CAApHDvrZKqZOMQYf=f5C5j3fP+Ls_3rY6=PZD8AcWZdf2byvWg@mail.gmail.com
Whole thread Raw
In response to IN clause behaving badly with missing comma and line break  (Roman Cervenak <roman@cervenak.info>)
List pgsql-bugs
On Wed, 18 Jan 2023 at 21:03, Roman Cervenak <roman@cervenak.info> wrote:
> if you use IN() clause (I've tested in WHERE and CASE) and you forget comma between values, it is syntax error
(correctbehaviour). But if there is newline between those two values, suddenly it is not syntax error (query will run
successfully),and all values are simply ignored. 
>
> Examples:
>
> WITH sample AS (SELECT 'c' AS t) SELECT CASE WHEN t IN ('a','b') THEN 1 WHEN t IN ('c'
>   'd') THEN 2 END FROM sample;

This is not a bug. See 4.1.2.1. String Constants in [1].

David

[1] https://www.postgresql.org/docs/current/sql-syntax-lexical.html



pgsql-bugs by date:

Previous
From: Roman Cervenak
Date:
Subject: IN clause behaving badly with missing comma and line break
Next
From: Amit Kapila
Date:
Subject: Re: Logical Replica ReorderBuffer Size Accounting Issues