Thread: Foreign Keys and ALTER RENAME TABLE
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.