Re: Trailing comma support in SELECT statements

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-04 19:58:14
Message-ID: 54305156.5020808@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/3/14, 4:02 PM, David G Johnston wrote:
> Should we also allow:
>
> SELECT
> , col1
> , col2
> , col3
> FROM ...
>
> ?
I would say yes, if we're going to do this. I don't see it being any worse than trailing commas.

If we are going to do this, we need to do it EVERYWHERE.

FWIW, the way I normally "work around" this problem is:

SELECT
blah
, foo
, bar
, baz

In my experience, it's quite uncommon to mess with the first item in the list, which mostly eliminates the issue. A missing leading comma is also MUCH easier to spot than a missing trailing comma.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2014-10-04 19:58:39 Re: Aussie timezone database changes incoming
Previous Message Jim Nasby 2014-10-04 19:52:40 Re: proposal: doc: simplify examples of dynamic SQL