When to use name verses id - Mailing list pgsql-novice

From Lewis Bergman
Subject When to use name verses id
Date
Msg-id 200202041451.g14Epvq11659@lewis.abi.tconline.net
Whole thread Raw
Responses Re: When to use name verses id  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
I got some very helpful suggestions last time I posted and have reworked my
entire db as a result.

I did away with a bunch of tbName for tables type stuff and a ton of pkName
and fkName for key columns. Thanks for the help and the design actually looks
a lot cleaner now.

My situation and question is now this:

I have some columns that I want to make sure have valid names in them.
For example one column refers to a foreign key which is a table containing
valid privilage access names like admin, user, agent, etc.... This
access_privilage table also has a serial column.

I guess my question is this. Should I _always_ refer to a serial or id type
of field or is there an appropriate time to refer to a name that the id
points to?

Do I even need an id column if I make the name column unique?

I used the suggestion made earlier when I needed a table to contain unique
names but each name needed multiple rows, That table only uses serial id's of
the referenced tables. I see the logic here because this table is "internel"
so to speak and won't be searched or reported on directly. These other tables
will be. Am I making sense here?
--
Lewis Bergman
Texas Communications
4309 Maple St.
Abilene, TX 79602-8044
915-695-6962 ext 115

pgsql-novice by date:

Previous
From: "Duncan Adams (DNS)"
Date:
Subject: Re: can u do three tables in left join?
Next
From: Tom Lane
Date:
Subject: Re: When to use name verses id