4.4、事务读一致性REPEATABLE READ
这种事务级别表示事务自始至终读取的数据都是一致的,如下所示
session1
postgres=# create table t_repeatable_read (id int,mc text);
NOTICE: Replica identity is needed for shard table, please add to this table through "alter table" command.
CREATE TABLE
postgres=# insert into t_repeatable_read values(1,'tbase');
INSERT 0 1
postgres=# begin isolation level repeatable read ;
BEGIN
postgres=# select * from t_repeatable_read ;
id | mc
----+-------
1 | tbase
(1 row)
session2
postgres=# insert into t_repeatable_read values(1,'pgxz');
INSERT 0 1
postgres=# select * from t_repeatable_read;
id | mc
----+-------
1 | tbase
1 | pgxz
(2 rows)
session1
postgres=# select * from t_repeatable_read ;
id | mc
----+-------
1 | tbase
(1 row)
postgres=#