Re: Column COMMENTs in CREATE TABLE? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Column COMMENTs in CREATE TABLE?
Date
Msg-id 24046.1467560507@sss.pgh.pa.us
Whole thread Raw
In response to Re: Column COMMENTs in CREATE TABLE?  (David Fetter <david@fetter.org>)
Responses Re: Column COMMENTs in CREATE TABLE?  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List 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 by date:

Previous
From: Kevin Grittner
Date:
Subject: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <
Next
From: Tom Lane
Date:
Subject: Re: fixing subplan/subquery confusion