What to do with no foreign keys - Mailing list pgsql-general

From Brian
Subject What to do with no foreign keys
Date
Msg-id Pine.LNX.3.96.980709141741.13012A-100000@mercury.shreve.net
Whole thread Raw
Responses Re: [GENERAL] What to do with no foreign keys  (Bruce Tong <zztong@laxmi.ev.net>)
List pgsql-general

If I have two tables, which are like this:

baseball_team
-------------
team_name
number_of_players
games_played
total_runs


baseball_game
-------------
home_team_name
visitor_team_name
home_runs
visitor_runs



How can I insure that for example "home_team_name" is one of
"baseball_team.team_name"?

I have seen in books things like:

PRIMARY KEY: home_team
FOREIGN KEY: home_team JOIN TO baseball_team.team_name

is there anyway to do this in postgresql? Bascially I have like 12 tables,
and alot of them have a field "username".  I want to insure that
"username" in all tables, is a valid username in "passwd.username".

Brian


/-------------------------- signal@shreve.net -----------------------------\
| Brian Feeny                | USR TC Hubs | ShreveNet Inc. (318)222-2638  |
| Network Administrator      | Perl, Linux | Web hosting, online stores,   |
| ShreveNet Inc.             |  USR Pilot  | Dial-Up 14.4-56k, ISDN & LANs |
| 89 CRX DX w/MPFI, lots of  |-=*:Quake:*=-| http://www.shreve.net/        |
| mods/Homepage coming soon  |LordSignal/SN| Quake server: 208.206.76.47   |
\-------------------------- 318-222-2638 x109 -----------------------------/



pgsql-general by date:

Previous
From: Kurt Seel
Date:
Subject: upgrade question
Next
From: Jeffrey Napolitano
Date:
Subject: Moving Databases