From: | Oliver Fromme <olli(at)lurza(dot)secnetix(dot)de> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Foreign keys and null |
Date: | 2003-09-29 11:40:59 |
Message-ID: | 200309291140.h8TBexmt025048@lurza.secnetix.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hi,
I have a table which contains information about MRTG graphs.
Each of the graphs belongs to a device (switch, router, host)
or to a service (web server, news server etc.), so I made a
second table containing those devices and services, and used
foreign keys in the graphs table to point into the devices
table. So far so good.
We also have a "component table" which contains information
about hardware componets (switches, routers etc.). So I had
the idea that I could make a link between the MRTG devices
table and the component table, i.e. put a foreign key in the
devices table pointing into the components table.
However -- The devices table also contains services which are
not in the components table (because they aren't hardware
components, but they are regarded as "virtual devices").
Normally the column should be null in those cases, but a
foreign key cannot be null, as far as I know.
Any hints or ideas? I'm probably missing some clue here,
or maybe my tables could be organized in a better way.
Regards
Oliver
--
Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.
Perl is worse than Python because people wanted it worse.
-- Larry Wall
From | Date | Subject | |
---|---|---|---|
Next Message | Oliver Fromme | 2003-09-29 12:44:03 | Re: Foreign keys and null |
Previous Message | Tom Lane | 2003-09-28 16:23:25 | Re: SQL Syntax problem |