pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedNotes or comments on columns in a table
4+ messages / 3 participants
[nested] [flat]
* Notes or comments on columns in a table
@ 2013-02-14 19:09 Campbell, Lance <lance@illinois.edu>
2013-02-14 20:10 ` Re: Notes or comments on columns in a table Thomas Kellerer <spam_eater@gmx.net>
2013-02-15 03:38 ` Re: Notes or comments on columns in a table Craig James <cjames@emolecules.com>
0 siblings, 2 replies; 4+ messages in thread
From: Campbell, Lance @ 2013-02-14 19:09 UTC (permalink / raw)
To: pgsql-admin
PostgreSQL 9.2
When creating a table or altering a column of a table, is there a way to add notes on a column?
If not:
I have a new enhancement request. When creating a table or altering a column, it would be nice if a user could add "comments" or "notes" to a column. This note would only appear when doing "\d table_name".
Why? I was adding a new column to a table called "type". Normally I only add types as characters even though integers are much better for indexing. The problem with integers is I never remember what value means what. Does a 1 mean directory or file. So I end up creating "type" as a character so I can do a quick SELECT DISTINCT to figure out the options. I would use integers if I could do \d table_name to see in the notes section what values meant. I would think other people run into this issue all the time.
Thanks,
Lance Campbell
Software Architect
Web Services at Public Affairs
217-333-0382
[University of Illinois at Urbana-Champaign logo]<http://illinois.edu/;
Attachments:
image001.png (image/png, 1.4K) download
view image
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Notes or comments on columns in a table
2013-02-14 19:09 Notes or comments on columns in a table Campbell, Lance <lance@illinois.edu>
@ 2013-02-14 20:10 ` Thomas Kellerer <spam_eater@gmx.net>
2013-02-15 15:07 ` Re: Notes or comments on columns in a table Campbell, Lance <lance@illinois.edu>
1 sibling, 1 reply; 4+ messages in thread
From: Thomas Kellerer @ 2013-02-14 20:10 UTC (permalink / raw)
To: pgsql-admin
Campbell, Lance wrote on 14.02.2013 20:09:
> PostgreSQL 9.2
>
> When creating a table or altering a column of a table, is there a way
> to add notes on a column?
>
comment on table foo is 'the foo table';
comment on column foo.bar is 'the bar column';
http://www.postgresql.org/docs/current/static/sql-comment.html
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Notes or comments on columns in a table
2013-02-14 19:09 Notes or comments on columns in a table Campbell, Lance <lance@illinois.edu>
2013-02-14 20:10 ` Re: Notes or comments on columns in a table Thomas Kellerer <spam_eater@gmx.net>
@ 2013-02-15 15:07 ` Campbell, Lance <lance@illinois.edu>
0 siblings, 0 replies; 4+ messages in thread
From: Campbell, Lance @ 2013-02-15 15:07 UTC (permalink / raw)
To: Thomas Kellerer <spam_eater@gmx.net>; pgsql-admin
I got it to work! You use the COMMENT in conjunction with \d+. Very nice.
PostgreSQL Development Team,
Thank you so much for having the COMMENT feature in PostgreSQL. This is great!
Thanks,
Lance Campbell
Software Architect
Web Services at Public Affairs
217-333-0382
-----Original Message-----
From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Thomas Kellerer
Sent: Thursday, February 14, 2013 2:10 PM
To: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] Notes or comments on columns in a table
Campbell, Lance wrote on 14.02.2013 20:09:
> PostgreSQL 9.2
>
> When creating a table or altering a column of a table, is there a way
> to add notes on a column?
>
comment on table foo is 'the foo table'; comment on column foo.bar is 'the bar column';
http://www.postgresql.org/docs/current/static/sql-comment.html
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Notes or comments on columns in a table
2013-02-14 19:09 Notes or comments on columns in a table Campbell, Lance <lance@illinois.edu>
@ 2013-02-15 03:38 ` Craig James <cjames@emolecules.com>
1 sibling, 0 replies; 4+ messages in thread
From: Craig James @ 2013-02-15 03:38 UTC (permalink / raw)
To: Campbell, Lance <lance@illinois.edu>; +Cc: pgsql-admin
On Thu, Feb 14, 2013 at 11:09 AM, Campbell, Lance <lance@illinois.edu>wrote:
> PostgreSQL 9.2****
>
> When creating a table or altering a column of a table, is there a way to
> add notes on a column?****
>
> ** **
>
> If not:****
>
> I have a new enhancement request. When creating a table or altering a
> column, it would be nice if a user could add “comments” or “notes” to a
> column. This note would only appear when doing “\d table_name”. ****
>
> ** **
>
> Why? I was adding a new column to a table called “type”. Normally I only
> add types as characters even though integers are much better for indexing.
> The problem with integers is I never remember what value means what. Does
> a 1 mean directory or file. So I end up creating “type” as a character so
> I can do a quick SELECT DISTINCT to figure out the options. I would use
> integers if I could do \d table_name to see in the notes section what
> values meant. I would think other people run into this issue all the time.
>
You should use an enumerated type definition.
create type my_file_type (
'File',
'Directory',
'SymLink')
create table foo (
id integer primary key,
filetype my_file_type
)
insert into foo(1, 'File');
select * from foo;
1 File
... and so forth.
Craig
> ****
>
> ** **
>
> ** **
>
> Thanks,****
>
> ** **
>
> Lance Campbell****
>
> Software Architect****
>
> Web Services at Public Affairs****
>
> 217-333-0382****
>
> [image: University of Illinois at Urbana-Champaign logo]<http://illinois.edu/;
> ****
>
> ** **
>
> ** **
>
Attachments:
image001.png (image/png, 1.4K) download
view image
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2013-02-15 15:07 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-02-14 19:09 Notes or comments on columns in a table Campbell, Lance <lance@illinois.edu>
2013-02-14 20:10 ` Thomas Kellerer <spam_eater@gmx.net>
2013-02-15 15:07 ` Campbell, Lance <lance@illinois.edu>
2013-02-15 03:38 ` Craig James <cjames@emolecules.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox