Re: URGENT: referential integrity problem

From: pginfo <pginfo(at)t1(dot)unisoftbg(dot)com>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: URGENT: referential integrity problem
Date: 2003-01-29 14:59:59
Message-ID: 3E37EC6F.BCA190E7@t1.unisoftbg.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Richard Huxton wrote:

> On Wednesday 29 Jan 2003 12:18 pm, pginfo wrote:
> > I have 2 tables, in the first one I have field that points to the table
> > key from the second.
> [snip]
> > After few min. pg drops with:
> > ERROR: <unnamed> referential integrity violation - key referenced from
> > a_table1 not found in a_table2 !
> >
> > My questions:
> > How is it possible, that pg do not check the references by inserts?
>
> Might be a damaged index - try a REINDEX (specified in the SQL reference
> manual). I'd also run some tests against your hardware, make sure you don't
> have any memory or disk problems.

No, I do not have any hardware/memory problems and it is not damaged index.In
my forst table I can execute:
select T1.ref_field from table1 T1 where T1.ref_field = 'A1';

and it returns 10 records.
by executing

select T2.id from table2 T2 where T2.id = 'A1';
and it returns 0 rows !

Also T1.ref_field points to T2.id and T2.id is the key for T2.
Also T1.ref_field and T2.id are declared as name.

>
>
> > How can I check the db integrity for all tables at once ( I need to be
> > sure, that do not exists any problems. It is production server).
>
> Simplest way I can think of would be to pg_dump and restore to a test
> installation.

I tryed it many times and pg do not report any errors.

My version is 7.3.1 running on r.h. 7.3.
I execute :
pg_dump > myfile

Then create a new db.
And execute psql -q newdb < myfile.

regards,
ivan.

>
>
> --
> Richard Huxton

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alan Carbutt 2003-01-29 15:04:01 Firewalls and Postgres
Previous Message FFabrizio 2003-01-29 14:53:15 Unsubscribing