PostgreSQL - properly change ID of table row
问题 How to change id of some table's row? Like: UPDATE table SET id=10 WHERE id=5; But in way that it would cascade changes to every other table that references this table with that id? I want to do this, because I need to import data from another database which has most of the same tables, but ids are different. So if ids would match old database, it would be easier to import data correctly. 回答1: Suppose you have these two tables: create table referenced (id integer primary key); create table