Re: Column COMMENTs in CREATE TABLE?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Column COMMENTs in CREATE TABLE?
Дата
Msg-id 24046.1467560507@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Column COMMENTs in CREATE TABLE?  (David Fetter <david@fetter.org>)
Ответы Re: Column COMMENTs in CREATE TABLE?  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-hackers
David Fetter <david@fetter.org> writes:
> On Sat, Jul 02, 2016 at 01:06:49PM -0400, David G. Johnston wrote:
>> ​+1 for the idea - though restricting it to columns would not be ideal.

> +1 for adding it to all the CREATEs whose objects support COMMENT.

TBH, I think this is a pretty bad idea.  I can see the reasoning for
allowing COMMENT in a table column definition, but the argument for
allowing it in simpler CREATEs seems tissue-thin:
CREATE FUNCTION foo(int) RETURNS ... ;COMMENT ON FUNCTION foo(int) IS 'blah';

vs
CREATE FUNCTION foo(int) RETURNS ...WITH (COMMENT 'blah');

Not much of a keystroke savings, nor is the comment noticeably
"closer" to its object than before.  Furthermore, the code footprint
of allowing that everywhere will be enormous.  And for statements that
already use WITH for something, I'm not sure you'll be able to
shoehorn this in without any grammatical trouble, either.  (It would
certainly be embarrassing if you did thirty-five flavors of CREATE
this way and then the syntax failed to work in the thirty-sixth.)

I think we should add something to ColumnDef and call it good.
        regards, tom lane



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

Предыдущее
От: Kevin Grittner
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <
Следующее
От: Tom Lane
Дата:
Сообщение: Re: fixing subplan/subquery confusion