Skip site navigation (1) Skip section navigation (2)

Relation n does not exist when trying to ad a foregin key

From: "Fabio Furia Silva" <ff-(at)uol(dot)com(dot)br>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Relation n does not exist when trying to ad a foregin key
Date: 2003-03-26 13:38:25
Message-ID: b5sah4$eat$1@news.hub.org (view raw or flat)
Thread:
Lists: pgsql-bugs
Dear all:

I am having this error when I try to add a foreign key:
ERROR:  Relation n does not exist

Here is the command:

test=# alter table cep_bairro add FOREIGN KEY (cod_localidade) REFERENCES
cidade (cod_localidade);

NOTICE:  ALTER TABLE will create implicit trigger(s) for FOREIGN KEY
check(s)
ERROR:  Relation 107890740 does not exist


On the other hand, the same command works for another table, when I try to
link to the same table:

test=# alter table cep_logra add FOREIGN KEY (cod_localidade) REFERENCES
cidade (cod_localidade);

NOTICE:  ALTER TABLE will create implicit trigger(s) for FOREIGN KEY
check(s)
ALTER TABLE
Time: 234175.99 ms

What is is going?

These 3 tables (cep_bairro, cep_logra and cidade) where changed a lot,
either by being recriated or via alter table.

Table cidade has its primary key changed, but both related tables
(cep_bairro, cep_logra) have their corresponded field also changed.

Thanks.


Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2003-03-26 14:35:13
Subject: Re: Bug #920: The PostgreSql Server goes down
Previous:From: Daniel RubioDate: 2003-03-26 13:02:40
Subject: Re: Can't connect to my postgresql

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group