Allowing additional commas between columns, and at the end of the SELECT clause - Mailing list pgsql-hackers

From Artur Formella
Subject Allowing additional commas between columns, and at the end of the SELECT clause
Date
Msg-id 0368c60f-abe2-4f5f-972d-7cd1e6db2382@gmail.com
Whole thread Raw
Responses Re: Allowing additional commas between columns, and at the end of the SELECT clause
Re: Allowing additional commas between columns, and at the end of the SELECT clause
List pgsql-hackers
Hello!
I have created a patch to allow additional commas between columns, and 
at the end of the SELECT clause.

Motivation:
Commas of this type are allowed in many programming languages, in some 
it is even recommended to use them at the ends of lists or objects. A 
new generation of programmers expects a more forgiving language just as 
our generation enjoyed LIMIT and the ability to write `select` in lowercase.

Accepted:
     SELECT 1,;
     SELECT 1,,,,,;
     SELECT *, from information_schema.sql_features;
     (...) RETURNING a,,b,c,;

Not accepted:
     SELECT ,;
     SELECT ,1;
     SELECT ,,,;

Advantages:
- simplifies the creation and debugging of queries by reducing the most 
common syntax error,
- eliminates the need to use the popular `1::int as dummy` at the end of 
a SELECT list,
- simplifies query generators,
- the query is still deterministic,

Disadvantages:
- counting of returned columns can be difficult,
- syntax checkers will still report errors,
- probably not SQL standard compliant,
- functionality can be controversial,

I attach the patch along with the tests.

What do you think?

Your opinions are very much welcome!


Attachment

pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: Why is citext/regress failing on hamerkop?
Next
From: Michael Paquier
Date:
Subject: Re: Weird test mixup