Re: Table Comments

From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: Carlos Mennens <carlos(dot)mennens(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Table Comments
Date: 2010-09-15 15:57:34
Message-ID: 20100915115734.eaf2a289.wmoran@potentialtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In response to Carlos Mennens <carlos(dot)mennens(at)gmail(dot)com>:

> I saw in the documentation for PostgreSQL that I can add 'comments' to
> table entries when creating columns:
>
> http://www.postgresql.org/docs/8.1/static/tutorial-table.html
>
> CREATE TABLE weather (
> city varchar(80),
> temp_lo int, -- low temperature
> temp_hi int, -- high temperature
> prcp real, -- precipitation
> date date
> );
>
> I did a search and don't understand in what aspect are the 'comments'
> relevant / visible? I don't see the comments when I attempt to list /
> describe the table with \d weather;

You're confusing table comments with SQL comments.

SQL comments (which you show above) comment the SQL and are lost if
the SQL code is not preserved. i.e., they do not affect what the
SQL does, thus they are not stored anywhere in the database. They're
a great help for documenting queries in you application code, though.

To add comments to a table (which it seems that you want) use the
COMMENT ON command to add them:
http://www.postgresql.org/docs/8.4/static/sql-comment.html

--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Octavio Alvarez 2010-09-15 15:59:17 Re: Table Comments
Previous Message Bryan Murphy 2010-09-15 15:55:00 Re: pgpool-II 3.0 + postgres 9rc1 + md5 authentication not working