Re: Referential integrity violation

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: <bombadil(at)wanadoo(dot)es>
Cc: Lista PostgreSql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Referential integrity violation
Date: 2002-03-13 16:20:51
Message-ID: 20020313081822.M81426-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Wed, 13 Mar 2002 bombadil(at)wanadoo(dot)es wrote:

> Database has more tables (obviously), but I supose it is enought with
> these.
>
> When I try next query:
>
> # update gasto SET importe = round(importe,2);
>
> I get error:
>
> ERROR: <unnamed> referential integrity violation - key
> referenced from gasto not found in aviso
>
> I supose this error means that there is a reference in field "aviso"
> of table "gasto" to inexistent "nmero" from "aviso" (data was
> imported with copy from other database).
>
> If it is so, then inserting data again in table "gasto" with inserts
> instead of copy sould fix situation, revoking inserts that woldn't
> comply with referential integrity rules.
>
> I have do it so:
>
> pg_dump -a -d -f foo.sql -t gasto database
>
> and after truncate data:
>
> psql database -f foo.sql
>
> Then, when I try my query again, I get same error. Have you any idea
> of actual problem? Where am I wrong in my asumptions?.

Can you distill an example case with test data (or real data if it's not
something that needs to be secured)? I see you're using inheritance
in your layout and I know that has some issues if you're referencing to
something that is inherited, but I'm not sure what's going on precisely.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2002-03-13 16:23:22 Re: Modifying text data?
Previous Message Doug McNaught 2002-03-13 16:15:01 Re: indices