Today I Learned

hashrocket A Hashrocket project

Add a Comment in Postgres

Today I learned about a neat Postgres feature, commenting. Here is a query adding a comment to a table:

>  comment on table developers is 'these are the authors';
COMMENT

Let's check see our comment

> \dt+ developers;
List of relations
-[ RECORD 1 ]----------------------
Schema      | public
Name        | developers
Type        | table
Owner       | jwworth
Size        | 16 kB
Description | these are the authors

You can comment on many things. Use this wherever you feel a comment is necessary or appropriate.

http://www.postgresql.org/docs/current/static/sql-comment.html

h/t Chris Erin and Jack Christensen

See More #sql TILs
Looking for help? Hashrocket developers believe that data quality is as important as code quality. We enjoy all the challenges of relational databases, from finding the fastest index, to structuring data to fit the needs of an application. We're eager to share our experiences; check out PG Casts, our series of free PostgreSQL screencasts.