4.3、回滚事务

  1. postgres=# begin;
  2. BEGIN
  3. postgres=# delete from tbase where id in (3,4);
  4. DELETE 2
  5. postgres=# select * from tbase;
  6. id | nickname
  7. ----+-------------
  8. 1 | hello TBase
  9. 2 | TBase
  10. (2 rows)
  11. postgres=# rollback;
  12. ROLLBACK

Rollback后数据又回来了

  1. postgres=# select * from tbase;
  2. id | nickname
  3. ----+---------------
  4. 1 | hello TBase
  5. 2 | TBase
  6. 3 | TBase
  7. 4 | TBase default
  8. (4 rows)