Re: Table Comments

From: Steve Crawford <scrawford(at)pinpointresearch(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 16:03:04
Message-ID: 4C90EE38.5060300@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 09/15/2010 08:53 AM, Carlos Mennens wrote:
> 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;
>
> Any suggestions?
>
>
Don't confuse "--" with "COMMENT ON".

A -- is SQL's comment "character", like # in Bash, // in C, etc. so you
can comment the SQL statements in your code.

The "COMMENT ON" statement lets you add descriptions to database objects
(tables, individual columns, etc.). See
http://www.postgresql.org/docs/8.1/static/sql-comment.html for more on
the COMMENT statement.

Cheers,
Steve

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gary Chambers 2010-09-15 16:04:30 Data Model Advice
Previous Message Michael Hull 2010-09-15 16:02:14 Using libpq, floats and binary data