sql - Rename a table used as reference in a another table -
sql - Rename a table used as reference in a another table - i have created 2 postgresql tables tables (the code originates 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 deferred, "name" varchar(128) not null ); i want rename table app_book app_item . next line sufficient, or have update references in app_author ? if so, how can that? alter table app_book rename app_item; looking @ this page, guess not. page not explain how update reference. see http://sqlfiddle.com/#!15/0dd1f/5 the problem described in link refers problems when using slony. if can live fact sequence "behind" id column not reflect name alter fine. if bothers you, need rename sequence well. note get_serial_sequence() still wo...