Allowing additional commas between columns, and at the end of the SELECT clause

Поиск
Список
Период
Сортировка
От Artur Formella
Тема Allowing additional commas between columns, and at the end of the SELECT clause
Дата
Msg-id 0368c60f-abe2-4f5f-972d-7cd1e6db2382@gmail.com
обсуждение исходный текст
Ответы 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
Список 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!


Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: Why is citext/regress failing on hamerkop?
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Weird test mixup