在 Postgres 中插入多个表时是否保留顺序

Is the order preserved when inserting into multiple tables in Postgres

我创建了3个table,没有外键,所以它们之间没有关联。 在我的程序中,我使用 JDBC 与 DB 进行交互。现在我有一个查询要立即插入到每个 table 中:

insert into table1 values (...);
insert into table2 values (...);
insert into table3 values (...);

我能期望插入语句按顺序执行,然后按顺序完成吗? 换句话说,我可以期望 table1 首先插入行,然后是 table2,最后是 table3 吗?

从程序的角度来看,插入将按顺序执行。

在您的事务之外,插入将在您的事务提交时同时出现。