Foreign Keys and ALTER RENAME TABLE

From: "Rod Taylor" <rbt(at)barchord(dot)com>
To: <pgsql-bugs(at)postgresql(dot)org>
Subject: Foreign Keys and ALTER RENAME TABLE
Date: 2001-06-24 15:08:07
Message-ID: 011301c0fcbf$79be4680$1600a8c0@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Attachment Content-Type Size
Taylor, Rod B.vcf text/x-vcard 451 bytes

Browse pgsql-bugs by date

  From Date Subject
Next Message Emil Goldfrab 2001-06-24 23:11:40 Bug with POSTGRESQL JDBC Driver 7.1 -1.2
Previous Message Mark Patterson 2001-06-23 22:21:20 Error in README_for_BeOS for PostgreSQL 6.5.0