Re: [GENERAL] When to use COMMENT vs --

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: [GENERAL] When to use COMMENT vs --
Дата
Msg-id CAHyXU0yxAcJt-6KSRAf=aPALTiYvAsv-EL4LwF2eFSNr6QGJLw@mail.gmail.com
обсуждение исходный текст
Ответ на When to use COMMENT vs --  (Rich Shepard <rshepard@appl-ecosys.com>)
Список pgsql-general
On Wed, Dec 7, 2016 at 9:57 AM, Rich Shepard <rshepard@appl-ecosys.com> wrote:
>   I have used '-- ' to enter comments about tables or columns and am curious
> about the value of storing comments in tables using the COMMENT key word.
> When is the latter more appropriate than the former?

Main advantage of COMMENT is that the comments are transferred to the
database such that the comments will be made available to client tools
(like psql) and external programs.  For example, if you are generating
database diagrams out of the database automatically (which is a good
idea) with a good tool (I recommend SchemaSpy) the comments will
become visible.

Code style comments OTOH will decorate the file.  This is good if you
maintain your code as proper code, checking it into git and such,
which is also a very good idea.

Personally I tend to avoid COMMENT on aesthetics; I just dislike the
COMMENT section to *after* the object being created in code. If I had
a hypothetical "COMMENT ON NEXT OBJECT 'This is ...';" I would
probably use COMMENT a lot more :-).

merlin


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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: [GENERAL] Multidimentional array access
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] Multidimentional array access