pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedForiegn key constraint
4+ messages / 4 participants
[nested] [flat]
* Foriegn key constraint
@ 2000-12-05 22:03 Sivagami . <sivagami@worlddata.com>
2000-12-12 17:56 ` Re: Foriegn key constraint Stephan Szabo <sszabo@megazone23.bigpanda.com>
2000-12-12 18:28 ` Re: Foriegn key constraint Jie Liang <jliang@jliang.ipinc.com>
0 siblings, 2 replies; 4+ messages in thread
From: Sivagami . @ 2000-12-05 22:03 UTC (permalink / raw)
To: pgsql-admin
Hi,
I have a question. I tried adding a Foreign Key constraint to a table via the ALTER TABLE command. But the records in the table did not match with those in the Parent table. Now my Alter table command, instead of giving me an error of kind - 'records do not match', has gone into a kind of Deadlock between the 2 tables. I am not able to select from the tables, nor delete them, nor drop them. If I try to do any of these, I get the error saying -
" Error : RelationBuildTriggers: 2 record(s) not found for rel invoice"
How do I overcome this error. Any ideas will be greatly appreciated.
Thanks a lot in advance.
Shiva.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Foriegn key constraint
2000-12-05 22:03 Foriegn key constraint Sivagami . <sivagami@worlddata.com>
@ 2000-12-12 17:56 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
1 sibling, 0 replies; 4+ messages in thread
From: Stephan Szabo @ 2000-12-12 17:56 UTC (permalink / raw)
To: Sivagami . <sivagami@worlddata.com>; +Cc: pgsql-admin
Can you give the sequence of commands you used and the
version?
The easiest way to get rid of the message is to set the
reltriggers for the pg_class row associated to invoice
to the correct number. It seems like the number of triggers
got updated but the triggers themselves were never added.
Stephan Szabo
sszabo@bigpanda.com
On Tue, 5 Dec 2000, Sivagami . wrote:
> Hi,
>
> I have a question. I tried adding a Foreign Key constraint to a table via the ALTER TABLE command. But the records in the table did not match with those in the Parent table. Now my Alter table command, instead of giving me an error of kind - 'records do not match', has gone into a kind of Deadlock between the 2 tables. I am not able to select from the tables, nor delete them, nor drop them. If I try to do any of these, I get the error saying -
> " Error : RelationBuildTriggers: 2 record(s) not found for rel invoice"
>
> How do I overcome this error. Any ideas will be greatly appreciated.
> Thanks a lot in advance.
>
> Shiva.
>
>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Foriegn key constraint
2000-12-05 22:03 Foriegn key constraint Sivagami . <sivagami@worlddata.com>
@ 2000-12-12 18:28 ` Jie Liang <jliang@jliang.ipinc.com>
1 sibling, 0 replies; 4+ messages in thread
From: Jie Liang @ 2000-12-12 18:28 UTC (permalink / raw)
To: Sivagami . <sivagami@worlddata.com>; +Cc: pgsql-admin
Hi,there,
You may try use pg_dump to recover :
pg_dump -t tablename -f outfile dbname
then use vi to erase the foreign key from outfile.
drop your original tables, reload your tables
without foreign key.
Jie LIANG
Internet Products Inc.
10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873
jliang@ipinc.com
www.ipinc.com
On Tue, 5 Dec 2000, Sivagami . wrote:
[NON-Text Body part not included]
^ permalink raw reply [nested|flat] 4+ messages in thread
* RE: Foriegn key constraint
@ 2000-12-12 14:17 Trewern, Ben <Ben.Trewern@mowlem.com>
0 siblings, 0 replies; 4+ messages in thread
From: Trewern, Ben @ 2000-12-12 14:17 UTC (permalink / raw)
To: pgsql-admin
I am pretty sure that the ALTER TABLE command does not do any checking when
it creates the triggers which produce a foreign key constraint. The DBA is
assumed to have checked the tables before they create the constraint. Best
thing I can think of is to do is drop these triggers and then sort out your
table before setting up your foreign key constraint.
Hope this helps
Ben
-----Original Message-----
From: Sivagami . [mailto:sivagami@worlddata.com]
Sent: 05 December 2000 22:04
To: pgsql-admin@postgresql.org
Subject: [ADMIN] Foriegn key constraint
Hi,
I have a question. I tried adding a Foreign Key constraint to a table via
the ALTER TABLE command. But the records in the table did not match with
those in the Parent table. Now my Alter table command, instead of giving me
an error of kind - 'records do not match', has gone into a kind of Deadlock
between the 2 tables. I am not able to select from the tables, nor delete
them, nor drop them. If I try to do any of these, I get the error saying -
" Error : RelationBuildTriggers: 2 record(s) not found for rel invoice"
How do I overcome this error. Any ideas will be greatly appreciated.
Thanks a lot in advance.
Shiva.
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2000-12-12 18:28 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-12-05 22:03 Foriegn key constraint Sivagami . <sivagami@worlddata.com>
2000-12-12 17:56 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2000-12-12 18:28 ` Jie Liang <jliang@jliang.ipinc.com>
2000-12-12 14:17 RE: Foriegn key constraint Trewern, Ben <Ben.Trewern@mowlem.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox