From: | Craig James <cjames(at)emolecules(dot)com> |
---|---|
To: | "Campbell, Lance" <lance(at)illinois(dot)edu> |
Cc: | "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: Notes or comments on columns in a table |
Date: | 2013-02-15 03:38:35 |
Message-ID: | CAFwQ8rfcuw8FsBVa9_Spjg+mmyw0TnLpjtiRwZ84enGpRWZVjw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
On Thu, Feb 14, 2013 at 11:09 AM, Campbell, Lance <lance(at)illinois(dot)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/>
> ****
>
> ** **
>
> ** **
>
From | Date | Subject | |
---|---|---|---|
Next Message | Campbell, Lance | 2013-02-15 15:07:22 | Re: Notes or comments on columns in a table |
Previous Message | Thomas Kellerer | 2013-02-14 20:10:10 | Re: Notes or comments on columns in a table |