回滚事务

最近更新时间: 2025-02-18 16:02:00

  • 复制
    复制成功
postgres=# begin;
BEGIN
postgres=# delete from tbase where id in (3,4);
DELETE 2
postgres=# select * from tbase;
 id |  nickname   
----+-------------
  1 | hello TDSQL PG
  2 | TDSQL PG好
(2 rows)
postgres=# rollback;
ROLLBACK
#Rollback后数据又回来了
postgres=# select * from tbase;
 id |   nickname    
----+---------------
  1 | hello TDSQL PG
  2 | TDSQL PG好
  3 | TDSQL PG好
  4 | TDSQL PG default
(4 rows)