I have created two PostgreSQL tables tables (the code originates from a Django app):
CREATE TABLE "app_book" (
"id" serial NOT NULL PRIMARY KEY,
"title" varchar(256)
);
CREATE TABLE "app_author" (
"book_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "app_book" ("id") DEFERRABLE INITIALLY DEFERRED,
"name" varchar(128) NOT NULL
);
I want to rename the table app_book
to app_item
. Is the following line sufficient, or do I also have to update the REFERENCES in app_author
? If so, how can I do that?
ALTER TABLE app_book RENAME TO app_item;
Looking at this page, I guess that it does not. But the page does not explain how to update the reference.