- 这样就链接到了temp数据库了
ztz123@ubuntu:~$ psql -d temp
psql (11.2)
Type "help" for help.
temp=# select txid_current();
txid_current
--------------
645
(1 row)
temp=# select txid_current();
txid_current
--------------
646
(1 row)
- 看到没,上面俩个居然不一样!
- 这说明,这种情况下,每执行一条命令就commit一条内容的!
temp=# begin;
BEGIN
temp=# select txid_current();
txid_current
--------------
647
(1 row)
temp=# select txid_current();
txid_current
--------------
647
(1 row)
temp=# end;
COMMIT
temp=# select txid_current();
txid_current
--------------
648
(1 row)
- 如果用bein end语法
- 那就是end之后才提交吧!