Re: Trailing comma support in SELECT statements

Lists: pgsql-hackers
From: Bogdan Pilch <bogdan(at)matfyz(dot)cz>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Trailing comma support in SELECT statements
Date: 2014-09-28 11:42:46
Message-ID: 20140928114246.GA22150@artax.karlin.mff.cuni.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,
I have created a small patch to postgres source (in particular the
psql part of it) that accepts trailing comma at the end of list in
SELECT statement.

The idea is to be able to say both (with the same result):
SELECT a, b, c from t;
SELECT a, b, c, from t;

Attached you can find a patch containing regression test (incorporated
into the serial_schedule).
My patch is relative to origin/REL9_4_STABLE branch as that is the one
I started from.

My plea is to have this change merged into the main stream so that it
becomes available in upcoming releases.

This modification does not require any interaction with user.
It does not create any backward compatibility issues.
Not does it have any performance impact.

regards
bogdan

Attachment Content-Type Size
0001-trailing_comma_support.patch text/x-diff 3.3 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bogdan Pilch <bogdan(at)matfyz(dot)cz>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-03 16:18:49
Message-ID: 24510.1412353129@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bogdan Pilch <bogdan(at)matfyz(dot)cz> writes:
> I have created a small patch to postgres source (in particular the
> psql part of it) that accepts trailing comma at the end of list in
> SELECT statement.

This doesn't seem to me to be a remarkably good idea. What's the
difference between this and accepting random misspellings of SELECT,
allowing mismatched parentheses in expressions, etc etc? It's important
in a computer language to be able to catch typos.

If we were going to be lax about trailing commas, the SELECT list
would hardly be the only candidate, or even the first candidate,
for being lax that way. But I don't want to go there.

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Bogdan Pilch <bogdan(at)matfyz(dot)cz>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-03 16:20:27
Message-ID: 20141003162027.GD14522@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Sep 28, 2014 at 01:42:46PM +0200, Bogdan Pilch wrote:
> Hi,
> I have created a small patch to postgres source (in particular the
> psql part of it) that accepts trailing comma at the end of list in
> SELECT statement.
>
> The idea is to be able to say both (with the same result):
> SELECT a, b, c from t;
> SELECT a, b, c, from t;
>
> Attached you can find a patch containing regression test (incorporated
> into the serial_schedule).
> My patch is relative to origin/REL9_4_STABLE branch as that is the one
> I started from.
>
> My plea is to have this change merged into the main stream so that it
> becomes available in upcoming releases.
>
> This modification does not require any interaction with user.
> It does not create any backward compatibility issues.

Interesting --- I know some languages allow trailing delimiters, like
Perl and Javascript. Could this mask query errors? Does any other
database accept this? Seems this would need to be done in many other
places, like UPDATE, but let's first decide if we want this.

FYI, it is usually better to discuss a feature before showing a patch.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Bogdan Pilch <bogdan(at)matfyz(dot)cz>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-03 20:37:19
Message-ID: 542F08FF.9010600@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On 10/03/2014 12:20 PM, Bruce Momjian wrote:
> On Sun, Sep 28, 2014 at 01:42:46PM +0200, Bogdan Pilch wrote:
>> Hi,
>> I have created a small patch to postgres source (in particular the
>> psql part of it) that accepts trailing comma at the end of list in
>> SELECT statement.
>>
>> The idea is to be able to say both (with the same result):
>> SELECT a, b, c from t;
>> SELECT a, b, c, from t;
>>
>> Attached you can find a patch containing regression test (incorporated
>> into the serial_schedule).
>> My patch is relative to origin/REL9_4_STABLE branch as that is the one
>> I started from.
>>
>> My plea is to have this change merged into the main stream so that it
>> becomes available in upcoming releases.
>>
>> This modification does not require any interaction with user.
>> It does not create any backward compatibility issues.
> Interesting --- I know some languages allow trailing delimiters, like
> Perl and Javascript. Could this mask query errors? Does any other
> database accept this? Seems this would need to be done in many other
> places, like UPDATE, but let's first decide if we want this.
>
> FYI, it is usually better to discuss a feature before showing a patch.
>

Javascript might accept it, but it's not valid JSON.

The case for doing it is that then you can easily comment out any entry
at all in a select list:

select
foo as f1,
bar as f2,
-- baz as f3,
from blurfl

cheers

andrew


From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-03 21:02:44
Message-ID: 1412370164737-5821694.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andrew Dunstan wrote
> On 10/03/2014 12:20 PM, Bruce Momjian wrote:
>> On Sun, Sep 28, 2014 at 01:42:46PM +0200, Bogdan Pilch wrote:
>>> Hi,
>>> I have created a small patch to postgres source (in particular the
>>> psql part of it) that accepts trailing comma at the end of list in
>>> SELECT statement.
>>>
>>> The idea is to be able to say both (with the same result):
>>> SELECT a, b, c from t;
>>> SELECT a, b, c, from t;
>>>
>>> Attached you can find a patch containing regression test (incorporated
>>> into the serial_schedule).
>>> My patch is relative to origin/REL9_4_STABLE branch as that is the one
>>> I started from.
>>>
>>> My plea is to have this change merged into the main stream so that it
>>> becomes available in upcoming releases.
>>>
>>> This modification does not require any interaction with user.
>>> It does not create any backward compatibility issues.
>> Interesting --- I know some languages allow trailing delimiters, like
>> Perl and Javascript. Could this mask query errors? Does any other
>> database accept this? Seems this would need to be done in many other
>> places, like UPDATE, but let's first decide if we want this.
>>
>> FYI, it is usually better to discuss a feature before showing a patch.
>>
>
> Javascript might accept it, but it's not valid JSON.
>
> The case for doing it is that then you can easily comment out any entry
> at all in a select list:
>
> select
> foo as f1,
> bar as f2,
> -- baz as f3,
> from blurfl

Should we also allow:

SELECT
, col1
, col2
, col3
FROM ...

?

The other reason for this would be to build dynamic SQL more easily via a
loop.

Barring arguments showing danger allowing I don't see a reason to reject
this; let people decide whether they want to utilize it on stylistic or
compatibility grounds.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Trailing-comma-support-in-SELECT-statements-tp5821613p5821694.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Bogdan Pilch <bogdan(at)matfyz(dot)cz>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-03 21:14:39
Message-ID: CAFj8pRC1GWeT3w2w1A0+zbdR3ogmBdhyKzKpwLnmxY_p_TpDWQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2014-09-28 13:42 GMT+02:00 Bogdan Pilch <bogdan(at)matfyz(dot)cz>:

> Hi,
> I have created a small patch to postgres source (in particular the
> psql part of it) that accepts trailing comma at the end of list in
> SELECT statement.
>

It is ANSI/SQL ?

Why we should to enable? We can be tolerant to this bug, but then
developers will hate us, when they will try to port to other servers.

-1 from me

Regards

Pavel

>
> The idea is to be able to say both (with the same result):
> SELECT a, b, c from t;
> SELECT a, b, c, from t;
>
> Attached you can find a patch containing regression test (incorporated
> into the serial_schedule).
> My patch is relative to origin/REL9_4_STABLE branch as that is the one
> I started from.
>
> My plea is to have this change merged into the main stream so that it
> becomes available in upcoming releases.
>
> This modification does not require any interaction with user.
> It does not create any backward compatibility issues.
> Not does it have any performance impact.
>
> regards
> bogdan
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
>


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
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.


From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-17 04:34:59
Message-ID: 1413520499323-5823365.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Jim Nasby-5 wrote
> 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.
>
>
> --
> Sent via pgsql-hackers mailing list (

> pgsql-hackers@

> )
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers

Jim Nasby-5 wrote
> 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.

We might as well allow a final trailing (or initial leading) comma on a
values list at the same time:

VALUES
(...),
(...),
(...),
;

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Trailing-comma-support-in-SELECT-statements-tp5821613p5823365.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-17 04:42:19
Message-ID: CAFj8pRBFQcAM8zVhG69uSeAj8e-CB3wzTCuBfAsXj0dRrzSXAA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2014-10-17 6:34 GMT+02:00 David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>:

> Jim Nasby-5 wrote
> > 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.
>

do you know, so this feature is a proprietary and it is not based on
ANSI/SQL? Any user, that use this feature and will to port to other
database will hate it.

Regards

Pavel

> >
> >
> > --
> > Sent via pgsql-hackers mailing list (
>
> > pgsql-hackers@
>
> > )
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgsql-hackers
>
>
> Jim Nasby-5 wrote
> > 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.
>
> We might as well allow a final trailing (or initial leading) comma on a
> values list at the same time:
>
> VALUES
> (...),
> (...),
> (...),
> ;
>
>
> David J.
>
>
>
>
> --
> View this message in context:
> http://postgresql.1045698.n5.nabble.com/Trailing-comma-support-in-SELECT-statements-tp5821613p5823365.html
> Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>


From: David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-17 04:48:40
Message-ID: CAKFQuwa91gxCgm9AsVZxSc2LR=aH5JAJZc+++9RqczRDq_vwWQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

>
> ​
> ​
>
>> We might as well allow a final trailing (or initial leading) comma on a
>> values list at the same time:
>>
>> VALUES
>> (...),
>> (...),
>> (...),
>>
> ​
>
> do you know, so this feature is a proprietary and it is not based on
> ANSI/SQL? Any user, that use this feature and will to port to other
> database will hate it.
>
> Regards
>
> Pavel
>
> ​
>

​I've got no complaint if "at the same time" means that neither behavior is
ever implemented...

David J.


From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-17 15:23:32
Message-ID: 1413559412.6298.YahooMailNeo@web122301.mail.ne1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:

> do you know, so this feature is a proprietary and it is not based
> on ANSI/SQL? Any user, that use this feature and will to port to
> other database will hate it.

I remember that Sybase ASE allowed a trailing comma within the
parentheses of a table definition, which was handy. I checked on
SQL Fiddle and found that MS SQL Server and MySQL both allow that,
too; although Oracle does not. I'm not taking a position on
whether we should allow this in PostgreSQL, but not having it is
likely to annoy some users moving *to* PostgreSQL, while having it
is likely to annoy some users moving *away* from PostgreSQL.

None of the products I tried allowed a leading comma.

I didn't test, and have no knowledge regarding, how other products
treat extra commas elsewhere.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-17 22:11:50
Message-ID: 54419426.1020506@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 10/16/14, 11:48 PM, David Johnston wrote:
> We might as well allow a final trailing (or initial leading) comma on a
> values list at the same time:
<snip>

> do you know, so this feature is a proprietary and it is not based on ANSI/SQL? Any user, that use this feature and will to port to other database will hate it.
>
> ​I've got no complaint if "at the same time" means that neither behavior is ever implemented...

As I originally posted, if we're going to do this I think we should do it *EVERYWHERE* commas are used as delimiters, save COPY input and output. Or we should at least get close to doing it everywhere. I think the only way things could get more annoying is if we accepted extra commas in SELECT but not in CREATE TABLE (as one example).

To me completeness is more important than whether we do it or not; that said, I like the idea (as well as supporting leading extra commas).
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
Cc: David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-17 22:18:47
Message-ID: 11052.1413584327@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> writes:
> As I originally posted, if we're going to do this I think we should do it *EVERYWHERE* commas are used as delimiters, save COPY input and output. Or we should at least get close to doing it everywhere. I think the only way things could get more annoying is if we accepted extra commas in SELECT but not in CREATE TABLE (as one example).

> To me completeness is more important than whether we do it or not; that said, I like the idea (as well as supporting leading extra commas).

Yeah, exactly. Personally I'm *not* for this, but if we do it we should
do it consistently: every comma-separated list in the SQL syntax should
work the same.

regards, tom lane


From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>, David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-18 04:19:46
Message-ID: EADE66ED-136A-43BF-89E7-ED1E04F72102@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Oct 17, 2014, at 3:18 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Yeah, exactly. Personally I'm *not* for this, but if we do it we should
> do it consistently: every comma-separated list in the SQL syntax should
> work the same.

PL/pgSQL, too, I presume.

D


From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: "David E(dot) Wheeler" <david(at)justatheory(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-19 02:06:51
Message-ID: 54431CBB.2010801@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 10/17/14, 11:19 PM, David E. Wheeler wrote:
> On Oct 17, 2014, at 3:18 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> Yeah, exactly. Personally I'm *not* for this, but if we do it we should
>> do it consistently: every comma-separated list in the SQL syntax should
>> work the same.
>
> PL/pgSQL, too, I presume.

Yes.

The only case I can think of where we wouldn't want this is COPY.

BTW, this should also apply to delimiters other than commas; for example, some geometry types use ; as a delimiter between points.

I do think such a change should be made in stages, and maybe not every last one makes it into 9.5, but the intention should certainly be that we support extra delimiters *everywhere*.
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com


From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-20 15:59:53
Message-ID: AFD796C4-8C81-40D0-BCA8-6D509EBC17FD@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Oct 18, 2014, at 7:06 PM, Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> wrote:

> Yes.
>
> The only case I can think of where we wouldn't want this is COPY.
>
> BTW, this should also apply to delimiters other than commas; for example, some geometry types use ; as a delimiter between points.

I don’t think it should apply to the internals of types, necessarily. JSON, for example, always dies on an trailing comma, so should probably stay that way. Well, maybe allow it on JSONB input, but not JSON. Though we perhaps don’t want their behaviors to diverge.

D


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: "David E(dot) Wheeler" <david(at)justatheory(dot)com>, Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-20 16:16:52
Message-ID: 54453574.4030106@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On 10/20/2014 11:59 AM, David E. Wheeler wrote:
> On Oct 18, 2014, at 7:06 PM, Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> wrote:
>
>> Yes.
>>
>> The only case I can think of where we wouldn't want this is COPY.
>>
>> BTW, this should also apply to delimiters other than commas; for example, some geometry types use ; as a delimiter between points.
> I don’t think it should apply to the internals of types, necessarily. JSON, for example, always dies on an trailing comma, so should probably stay that way. Well, maybe allow it on JSONB input, but not JSON. Though we perhaps don’t want their behaviors to diverge.
>

The JSON spec is quite clear on this. Leading and trailing commas are
not allowed. I would fight tooth and nail not to allow it for json (and
by implication jsonb, since they use literally the same parser - in fact
we do that precisely so their input grammars can't diverge).

cheers

andrew


From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>, "David E(dot) Wheeler" <david(at)justatheory(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-21 00:57:00
Message-ID: 5445AF5C.7090302@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 10/20/14, 11:16 AM, Andrew Dunstan wrote:
> On 10/20/2014 11:59 AM, David E. Wheeler wrote:
>> On Oct 18, 2014, at 7:06 PM, Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> wrote:
>>
>>> Yes.
>>>
>>> The only case I can think of where we wouldn't want this is COPY.
>>>
>>> BTW, this should also apply to delimiters other than commas; for example, some geometry types use ; as a delimiter between points.
>> I don’t think it should apply to the internals of types, necessarily. JSON, for example, always dies on an trailing comma, so should probably stay that way. Well, maybe allow it on JSONB input, but not JSON. Though we perhaps don’t want their behaviors to diverge.
>>
>
>
> The JSON spec is quite clear on this. Leading and trailing commas are not allowed. I would fight tooth and nail not to allow it for json (and by implication jsonb, since they use literally the same parser - in fact we do that precisely so their input grammars can't diverge).

+1. Data types that implement specs should follow the spec.

I was more concerned about things like polygon, but the real point (ha!) is that we need to think about the data types too. (I will say I don't think things that mandate an exact number of elements (like point, box, etc) should support extra delimiters).
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, "David E(dot) Wheeler" <david(at)justatheory(dot)com>, David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-21 14:16:38
Message-ID: 14881.1413900998@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> writes:
> On 10/20/14, 11:16 AM, Andrew Dunstan wrote:
>> The JSON spec is quite clear on this. Leading and trailing commas are not allowed. I would fight tooth and nail not to allow it for json (and by implication jsonb, since they use literally the same parser - in fact we do that precisely so their input grammars can't diverge).

> +1. Data types that implement specs should follow the spec.

> I was more concerned about things like polygon, but the real point (ha!) is that we need to think about the data types too. (I will say I don't think things that mandate an exact number of elements (like point, box, etc) should support extra delimiters).

I'm pretty strongly against this, as it would create cross-version hazards
for data. Having queries that depend on newer-version SQL features is
something that people are used to coping with ... but data that loads into
some versions and not others seems like a hassle we do not need to invent.

(Of course, I'm not for the feature w.r.t. SQL either. But breaking data
compatibility is just adding an entire new dimension of trouble.)

regards, tom lane


From: Alex Goncharov <alex(dot)goncharov(dot)usa(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, "David E(dot) Wheeler" <david(at)justatheory(dot)com>, David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-24 13:36:59
Message-ID: CAOnt2=MJ_oTUi_fWGd5mBJQD=5-k-bJXXUfQeL8OdTybgJejhw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Oct 21, 2014 at 10:16 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> (Of course, I'm not for the feature w.r.t. SQL either. But breaking data
> compatibility is just adding an entire new dimension of trouble.
>

Another dimension of the trouble is breaking the operation of the
tools that parse SQL statements for various purposes, e.g. for
dependency analysis.

This is a misfeature for the benefit of edit-lazy users only.

-- Alex


From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Alex Goncharov <alex(dot)goncharov(dot)usa(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, "David E(dot) Wheeler" <david(at)justatheory(dot)com>, David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-28 12:20:06
Message-ID: 20141028122006.GC1791@alvin.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Alex Goncharov wrote:

> This is a misfeature for the benefit of edit-lazy users only.

+1

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Alex Goncharov <alex(dot)goncharov(dot)usa(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, "David E(dot) Wheeler" <david(at)justatheory(dot)com>, David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-28 18:39:32
Message-ID: CAFj8pRAT4pfVEJGh8CVjKowr8_nTFb+bihnp7faNd3d7obNTJA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2014-10-28 13:20 GMT+01:00 Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>:

> Alex Goncharov wrote:
>
> > This is a misfeature for the benefit of edit-lazy users only.
>
> +1
>
>
+1

Pavel

> --
> Álvaro Herrera http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Training & Services
>


From: Joe Conway <mail(at)joeconway(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Alex Goncharov <alex(dot)goncharov(dot)usa(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, "David E(dot) Wheeler" <david(at)justatheory(dot)com>, David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-28 18:40:22
Message-ID: 544FE316.7050703@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/28/2014 05:20 AM, Alvaro Herrera wrote:
> Alex Goncharov wrote:
>
>> This is a misfeature for the benefit of edit-lazy users only.
>
> +1

+1

Joe

- --
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJUT+MWAAoJEDfy90M199hllO8QAICsG86NK9hQE4QPLppIMkbv
E5qGAv0Hml/g+dKtsDpxo1f2L5dguQnAQD7ERZeEMWv0X28PixN+PDxfUVUjFKm2
5uI+OiJ60xM4oN+/eNgt4gaJWgk8osVmS9lx4jcGRTY+z9loxLQVUvWJ04nEdbV4
CJjcC6QZB0bpIDSkWYPZIB/YYrBLZ+/gI2GMWSIye8QutshHXd0Bca6gqWcgrBcK
sRVTVYd9hTNjnDLYPxSipuMJWHsyObMsSOnA0G9NuT+itj817uhOJhLOSq/Ctu02
C43CT4tM8Y0PX+EHhnkg2m0FMLeVYrSU8dCMI6MgjbSaghqjPRYHYjHoXyE9zqEk
M2Vw3qsqax0hx1AAJr//PIrCTf2Kc7T5K2soZkUXaIwrilrk7GTW1wtl+OCizn5D
Che5XCdwivh3m0Q6Wx/jtvdMqm1aJVA137kvHFLgR4SxkH2af/jhsP26ol5ieiAx
lno00w3JSjjeVl+EFzDTVBDsFD0FRffdlUxB1V+gUUQ+XvOdpfZEbyppQfP01+Bd
2WHnc2tYr0QJKWwnInFMeN+OHP7cOvE5C1I48DIZUSvI76astP3QWPtFXa30xFiA
CZUjzAKOqDQFvTpnHNMHoKRGCv28WZ525b5TPICWSO7EBaG2Uz/kMBvGXq4h6fOW
g9Rrm4UuMcMxoHhWoz2T
=JZC8
-----END PGP SIGNATURE-----


From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Alex Goncharov <alex(dot)goncharov(dot)usa(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-28 21:25:02
Message-ID: D5DD7BD5-BC93-46EE-837F-9ED7A67D4889@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Oct 24, 2014, at 6:36 AM, Alex Goncharov <alex(dot)goncharov(dot)usa(at)gmail(dot)com> wrote:

> Another dimension of the trouble is breaking the operation of the
> tools that parse SQL statements for various purposes, e.g. for
> dependency analysis.

That’s a valid point.

> This is a misfeature for the benefit of edit-lazy users only.

This one, however, is more a judgment of people and their practices rather than the feature itself. Color me unimpressed.

Best,

David


From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: "David E(dot) Wheeler" <david(at)justatheory(dot)com>, Alex Goncharov <alex(dot)goncharov(dot)usa(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-28 23:07:25
Message-ID: 545021AD.8080406@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 10/28/14, 4:25 PM, David E. Wheeler wrote:
>> This is a misfeature for the benefit of edit-lazy users only.
> This one, however, is more a judgment of people and their practices rather than the feature itself. Color me unimpressed.

+1.

Having users sweat of comma placement in this day and age is pretty stupid. I can understand why we wouldn't want to break backwards compatibility, but I think it does us and our users a disservice to dismiss the issue.

(BTW, I use a "comma first" formatting standard, so this doesn't actually effect me much, but I still find the original complaint very valid.)
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
Cc: "David E(dot) Wheeler" <david(at)justatheory(dot)com>, Alex Goncharov <alex(dot)goncharov(dot)usa(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-28 23:30:38
Message-ID: 21053.1414539038@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> writes:
> On 10/28/14, 4:25 PM, David E. Wheeler wrote:
>> This one, however, is more a judgment of people and their practices rather than the feature itself. Color me unimpressed.

> +1.

> Having users sweat of comma placement in this day and age is pretty stupid. I can understand why we wouldn't want to break backwards compatibility, but I think it does us and our users a disservice to dismiss the issue.

I don't think anyone is just dismissing the issue. But it is certainly a
judgment call as to whether the pros outweigh the cons, and I'm not seeing
a clear majority of us thinking they do.

regards, tom lane


From: David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Alex Goncharov <alex(dot)goncharov(dot)usa(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, "David E(dot) Wheeler" <david(at)justatheory(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-28 23:59:58
Message-ID: CAKFQuwbxM=pMxfZYHk9h8Q6WUUE1SAq+7PznNoY5KvU=k=3Skw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Oct 24, 2014 at 6:36 AM, Alex Goncharov <
alex(dot)goncharov(dot)usa(at)gmail(dot)com> wrote:

> On Tue, Oct 21, 2014 at 10:16 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> (Of course, I'm not for the feature w.r.t. SQL either. But breaking data
>> compatibility is just adding an entire new dimension of trouble.
>>
>
> Another dimension of the trouble is breaking the operation of the
> tools that parse SQL statements for various purposes, e.g. for
> dependency analysis.
>

​If you hit the tool before you hit PostgreSQL then obviously you need to
conform to whatever it accepts.

For SQL directly generated from system catalogs we should not add extra
commas. Function text is obviously one area where we keep queries as-is so
how does this play with existing pl/pgsql static analysis routines?

I'd be much more inclined to favor this if the user is provided a
capability to have warnings emitted whenever extraneous commas are present
- either via some form of strict mode or linting configuration.

I do like the idea of being able to write "column," instead of ", column"
with fewer "ooops" moments and marginal diff differences.

David J.


From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
Cc: "David E(dot) Wheeler" <david(at)justatheory(dot)com>, Alex Goncharov <alex(dot)goncharov(dot)usa(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-29 14:13:03
Message-ID: 1414591983.34042.YahooMailNeo@web122306.mail.ne1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> writes:
>> On 10/28/14, 4:25 PM, David E. Wheeler wrote:
>>> This one, however, is more a judgment of people and their
>>> practices rather than the feature itself. Color me unimpressed.
>>
>> +1.
>>
>> Having users sweat of comma placement in this day and age is
>> pretty stupid. I can understand why we wouldn't want to break
>> backwards compatibility, but I think it does us and our users a
>> disservice to dismiss the issue.
>
> I don't think anyone is just dismissing the issue. But it is
> certainly a judgment call as to whether the pros outweigh the
> cons, and I'm not seeing a clear majority of us thinking they do.

+1

My personal experience with products which allowed this (at least
in some circumstances) was that it occasionally saved me from an
"oops, ROLLBACK, retry" cycle. I feel there is some value to that.

It also seems probable that some people on such products maintain
their DDL scripts in this format to minimize such cycles in their
current environments, and for them the lack of such behavior in
PostgreSQL will cause some extra bumps on the road to conversion.
Smoothing the road for conversion to PostgreSQL also seems to have
some value.

I feel that these are both fairly small benefits, so in the absence
of any information on the costs of developing and maintaining this,
I don't have any opinion on whether it is worth it. I don't like
the scope of the initial proposal because that is not the place
where I noticed the feature in other products, and thus doubt that
it is the most important place to make the change, and think that
if we do it we had better have more consistency with it. If
someone offered a more comprehensive patch, I could look at it and
develop an opinion on whether the cost/benefit ratio looked like it
was worth it.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Alex Goncharov <alex(dot)goncharov(dot)usa(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, "David E(dot) Wheeler" <david(at)justatheory(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trailing comma support in SELECT statements
Date: 2014-10-29 16:01:06
Message-ID: CA+TgmoZvH3G7_tQb9owaUM1+JAU1ku0Ts9y1CUHzr5LOvZfQtQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Oct 28, 2014 at 7:59 PM, David Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> I'd be much more inclined to favor this if the user is provided a capability
> to have warnings emitted whenever extraneous commas are present - either via
> some form of strict mode or linting configuration.

My experience with this kind of thing has not been positive. You
write all your code in strict mode and have it turned on server-wide,
and then you want to install an extension which doesn't use strict
mode and you have to turn it off, but then you lose your own checks.
Uggh.

I think the discussion here is an example of taking a questionable
idea to its illogical conclusion. I don't believe that a decision to
allow a trailing comma in a SELECT list means that we also have to
allow trailing commas in every single kind of comma-separated list we
have anywhere in PostgreSQL, right down to some obscure type's input
functions. That's taking a simple idea that might possibly be worth
considering and expanding it into a giant project that nobody's ever
going to do, and certainly not correctly.

My personal vote is for not changing anything here at all. But I
don't think it's got to be all-or-nothing.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company