Re: Problem with some keys

From: Peter Headland <Peter(at)matrixlink(dot)com>
To: cipy(dot)mail(at)gmail(dot)com
Cc: sfpug(at)postgresql(dot)org
Subject: Re: Problem with some keys
Date: 2012-03-18 00:05:20
Message-ID: 4F6526C0.8000605@matrixlink.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: sfpug

The "ON UPDATE SET DEFAULT" clause in the FK definition tells Postgres
to change the value of mostra.museo to the default value of
museo.nomemuseo, which is 'MuseoVeronese'. In other words, it is as if
you had executed this:

UPDATE mostra SET museo = 'MuseoVeronese';

If you execute the statement above, you will see the same error. The
error is telling you that there is no row in the museo table with a
nomemuseo value of 'MuseoVeronese', so the FK relationship from mostra
to museo is violated. Looking at your INSERT statements, I see that you
never created a row for that museum; if you insert a row for
'MuseoVeronese' in museo, your problem will go away.

--
Peter Headland

In response to

Responses

Browse sfpug by date

  From Date Subject
Next Message cipy.mail 2012-03-18 14:38:16 Re: Problem with some keys
Previous Message Peter Headland 2012-03-17 21:36:35 Re: Problem with some keys