欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Oracle vs PostgreSQL, research precations (2)

程序员文章站 2022-03-04 13:02:57
...

When the Oracle executed statements like CREATE, RENAME or ALTER, that would be implicit submission; When the PG executed these statements, will not commit the transaction, need show submission.

--------------------------- Session A
drop table if exists t1;
-- start transaction
begin;
-- inquiry current transaction number
select txid_current();
-- create table &insert 100W data
create table t1(id int,c1 varchar(20));
-- inquiry current transaction number
select txid_current();
insert into t1 select generate_series(1,1000000),'#TESTDATA#';
rollback; --rollback transaction
select count(*) from t1;
prompt:
ERROR: relation "t1" does not exist
LINE 1: select count(*) from t1;

If it is Oracle database, that after created data table success will implicit submissions transaction, and rollback after insert data that table will still exist.
reference:
https://wiki.postgresql.org/wiki/Transactional_DDL_in_PostgreSQL:_A_Competitive_Analysis

相关标签: database