Re: IN clause behaving badly with missing comma and line break

From: Philip Semanchuk <philip(at)americanefficient(dot)com>
To: Francisco Olarte <folarte(at)peoplecall(dot)com>
Cc: Roman Cervenak <roman(at)cervenak(dot)info>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: IN clause behaving badly with missing comma and line break
Date: 2023-01-18 16:09:38
Message-ID: 65C07914-4AB4-43F5-BC5B-E73F1FE99185@americanefficient.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> On Jan 18, 2023, at 11:06 AM, Francisco Olarte <folarte(at)peoplecall(dot)com> wrote:
>
> On Wed, 18 Jan 2023 at 16:21, Philip Semanchuk
> <philip(at)americanefficient(dot)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. :-)

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Sam.Mesh 2023-01-18 21:43:43 Re: index not used for bigint without explicit cast
Previous Message Francisco Olarte 2023-01-18 16:06:21 Re: IN clause behaving badly with missing comma and line break