我正在使用 Postgres 9.3。
我有 2 个表 :authn_session
和customer
. 每个都authn_session
属于 a customer
(因此有 acustomer_id
作为列,这是客户的 FK id
)。
注意:这些表包含对其他表和索引的额外 FK 引用。
现在,我开始 2 个不同的事务,它们按照下面提到的顺序执行以下操作:
发送:1
BEGIN;
UPDATE customer
SET customer__created_by =
(case when customer__created_by = 1 then 5
else customer__created_by end),
customer__modified_by =
(case when customer__modified_by = 1 then 5
else customer__modified_by end);
UPDATE authn_session
SET authn_session__created_by =
(case when authn_session__created_by = 1 then 5
else authn_session__created_by end),
authn_session__modified_by =
(case when authn_session__modified_by = 1 …
Run Code Online (Sandbox Code Playgroud)