On Sat, Jul 02, 2016 at 01:06:49PM -0400, David G. Johnston wrote:
> On Sat, Jul 2, 2016 at 12:55 PM, Marko Tiikkaja <marko@joh.to> wrote:
>
> >
> > What I would prefer is something like this:
> >
> > CREATE TABLE foo(
> > f1 int NOT NULL COMMENT
> > 'the first field',
> > f2 int NOT NULL COMMENT
> > 'the second field',
> > ...
> > );
> >
> > which would ensure the comments are both next to the field definition
> > they're documenting and that they make it all the way to the database. I
> > looked into the biggest products, and MySQL supports this syntax. I
> > couldn't find any similar syntax in any other product.
> >
> >
> +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.
Might something like
CREATE ... [WITH (COMMENT $$Big honking comment here$$)]
for the explicit CREATE cases and something like
CREATE TABLE foo( id SERIAL PRIMARY KEY WITH (COMMENT 'Generated primary key, best find a natural one, too'),
t TEXT NOT NULL WITH (COMMENT 'Really? A single-letter name?!?'), ... )
for cases where the CREATE isn't part of the syntax help alleviate the
keyword issue?
I suggested doing it this way because where there's one thing, in this
case a COMMENT, it's reasonable to expect that there will be others
and make that simpler to do.
Best,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate