Re: BUG #14394: No error raised in IN-clause when commas are missing - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #14394: No error raised in IN-clause when commas are missing
Date
Msg-id 15138.1477320391@sss.pgh.pa.us
Whole thread Raw
In response to BUG #14394: No error raised in IN-clause when commas are missing  (andreas.imboden@bl.ch)
Responses Re: BUG #14394: No error raised in IN-clause when commas are missing  (Pantelis Theodosiou <ypercube@gmail.com>)
List pgsql-bugs
andreas.imboden@bl.ch writes:
> -- no comma after 'two', no error message, incorrect result
> select sum(cvalue) from abug =

>  where cname in (
>     'one', =

>     'two' =

>     'three', =

>     'four', =

>     'five'); =


This is not a bug, it's required by the SQL standard's syntax for
string literals.  Per the manual:

    Two string constants that are only separated by whitespace *with
    at least one newline* are concatenated and effectively treated as
    if the string had been written as one constant.

https://www.postgresql.org/docs/9.6/static/sql-syntax-lexical.html#SQL-SYN=
TAX-CONSTANTS

            regards, tom lane

pgsql-bugs by date:

Previous
From: andreas.imboden@bl.ch
Date:
Subject: BUG #14394: No error raised in IN-clause when commas are missing
Next
From: hubert depesz lubaczewski
Date:
Subject: Re: BUG #14394: No error raised in IN-clause when commas are missing