Re: IN clause behaving badly with missing comma and line break
Philip Semanchuk <philip@americanefficient.com>
From: Philip Semanchuk <philip@americanefficient.com>
To: Francisco Olarte <folarte@peoplecall.com>
Cc: Roman Cervenak <roman@cervenak.info>,
pgsql-bugs@lists.postgresql.org
Date: 2023-01-18T16:09:38Z
Lists: pgsql-bugs
> On Jan 18, 2023, at 11:06 AM, Francisco Olarte <folarte@peoplecall.com> wrote:
>
> On Wed, 18 Jan 2023 at 16:21, Philip Semanchuk
> <philip@americanefficient.com> wrote:
>
>> .... We’ve adopted a formatting standard that helps us to avoid surprises due to missing commas. We put one string literal on each line and place the commas all in the same column with a significant amount of white space to the left of the commas. With this safeguard in place, it’s very easy to spot a missing comma.
>>
>> WHERE t IN ('a' ,
>> 'foo' ,
>> 'bar' ,
>> )
>
> I believe that one is a syntax error ( last comma ).
Ooops, yes, thanks for catching that. I spend about half of my time in Python where that trailing comma is acceptable and idiomatic. Not so much in SQL. :-)