当表名更改时,我该如何修改对PostgreSQL中表的引用?
假设我有以下代码:
CREATE TABLE example1 (
id serial NOT NULL PRIMARY KEY,
name varchar(100)
);
CREATE TABLE example2 (
id serial NOT NULL PRIMARY KEY,
example1fk integer REFERENCES example1 (id) DEFERRABLE INITIALLY DEFERRED
);
后来我做:
ALTER TABLE example1 RENAME TO example3;
如何更改外键约束的定义?
example1fk integer REFERENCES example1 (id) DEFERRABLE INITIALLY DEFERRED,