Foreign Keys and ALTER RENAME TABLE - Mailing list pgsql-bugs

From Rod Taylor
Subject Foreign Keys and ALTER RENAME TABLE
Date
Msg-id 011301c0fcbf$79be4680$1600a8c0@jester
Whole thread Raw
List pgsql-bugs
It doesn't appear that Foreign keys are updated when renaming the
table.  Causing references to become non-existant.


create table foobar ( id SERIAL);

INSERT INTO foobar DEFAULT VALUES;

INSERT INTO foobar DEFAULT VALUES;

INSERT INTO foobar DEFAULT VALUES;

create table barfoo (id int4 REFERENCES foobar (id) ON UPDATE CASCADE
ON DELETE CASCADE);



update foobar set id = 10 where id = 1;

-- Works as expected

alter table barfoo rename to farboo;

-- No warnings from above line!



update foobar set id = 12 where id = 2;

-- ERROR: Relation 'barfoo' does not exist


--
Rod Taylor

Your eyes are weary from staring at the CRT. You feel sleepy. Notice
how restful it is to watch the cursor blink. Close your eyes. The
opinions stated above are yours. You cannot imagine why you ever felt
otherwise.

pgsql-bugs by date:

Previous
From: Steve Pothier
Date:
Subject: Re: COPY TO looses on view
Next
From: Emil Goldfrab
Date:
Subject: Bug with POSTGRESQL JDBC Driver 7.1 -1.2