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
推荐阅读
-
Oracle vs PostgreSQL,研发注意事项(10)- PostgreSQL数据类型转换规则#2
-
Oracle vs PostgreSQL,研发注意事项(5)- 字符类型
-
Oracle vs PostgreSQL DBA(13)- 拆分(split)分区
-
PostgreSQL vs Oracle checksum 配置与性能
-
Oracle vs PostgreSQL Develop(15) - DISTINCT ON
-
Oracle vs PostgreSQL,研发注意事项(9)- PostgreSQL数据类型转换规则#1
-
Oracle vs PostgreSQL,研发注意事项(7)- 类型转换
-
Oracle vs PostgreSQL,研发注意事项(11)- PostgreSQL数据类型转换规则#3
-
Oracle vs PostgreSQL Develop(16) - Prepared Statement
-
Oracle vs PostgreSQL Develop(17) - ARRAY