Foreign Key Constraints

From: "joemono" <montero7(at)msu(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Foreign Key Constraints
Date: 2002-06-28 15:26:04
Message-ID: afhubr$2k5b$1@msunews.cl.msu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I'm trying to understand foreign key constraints more, but having a heck of
a time doing so. I've been looking through Google groups to try to find
answers to the problems I'm having, but I haven't come across any as of yet.

Here is the situation:

I have a table of configurations. The config table has config_tag,
config_value columns. I also have a table of config_values, ones that are
valid for the config table. The config_values table has all the possible
configurations (only about 40 or so) that can be put into the config table.

Currently, the config_values table has as its primary key (tag, value), and
the config table has as a foreign key (config_tag, config_value) which
references config_values (tag, value). I've also messed around with match
full, but I'm not sure I understand it completely, and it hasn't solved the
problem I'm having yet.

I'm adding some new options, and so I added rows to the config_values table,
with completely new tags, but with values that other tags also use. (I'm
expanding existing options to cover other areas of the project). Now that
the rows are in the config_values table, I've decided to change them around,
and use different values, so I want to delete them. However, I keep getting:

"fk_config referential integrity violation - key in config_values still
referenced from config"

Like I said, I've been trying the match full option, because it only makes
sense to match the config_tag-config_value combination, since many of the
values have the same...value. Right?

Anyway, I hope this makes sense. Any help is greatly appreciated!

joemono

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Markus Wollny 2002-06-28 15:30:58 Re: One source of constant annoyance identified
Previous Message Tom Lane 2002-06-28 15:03:15 Re: One source of constant annoyance identified