事务读一致性REPEATABLE READ
最近更新时间: 2025-02-18 16:02:00
这种事务级别表示事务自始至终读取的数据都是一致的,如下所示:
#session1
postgres=# create table t_repeatable_read (id int,mc text);
CREATE TABLE
postgres=# insert into t_repeatable_read values(1,'TDSQL PG');
INSERT 0 1
postgres=# begin isolation level repeatable read ;
BEGIN
postgres=# select * from t_repeatable_read ;
id | mc
----+-------
1 | TDSQL PG
(1 row)
#session2
postgres=# insert into t_repeatable_read values(1,'pgxz');
INSERT 0 1
postgres=# select * from t_repeatable_read;
id | mc
----+-------
1 | TDSQL PG
1 | pgxz
(2 rows)
#session1
postgres=# select * from t_repeatable_read ;
id | mc
----+-------
1 | TDSQL PG
(1 row)
postgres=#